Commit 0b98133
mm/shrinker: fix refcount leak in shrink_slab_memcg()
mainline inclusion
from mainline-v7.1-rc1
category: bugfix
When kmem is disabled for memcg, slab-backed shrinkers are skipped.
However, shrink_slab_memcg() doesn't drop the reference acquired via
shrinker_try_get() before continuing.
Add the missing shrinker_put().
Also, since memcg_kmem_online() and shrinker flags cannot change
dynamically, remove the shrinker from the bitmap to avoid unnecessary
future scans.
Link: https://lkml.kernel.org/r/20260204033553.50039-1-ahacigu.linux@gmail.com
Fixes: 50d09da ("mm: shrinker: make memcg slab shrink lockless")
Signed-off-by: Altan Hacigumus <ahacigu.linux@gmail.com>
Acked-by: Qi Zheng <zhengqi.arch@bytedance.com>
Link: https://lore.kernel.org/r/20260203073757.135088-1-ahacigu.linux@gmail.com
Reviewed-by: Muchun Song <muchun.song@linux.dev>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 260d70819c37cf59383286f8dc6566eaa32776bb)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>1 parent 97afe56 commit 0b98133
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
547 | | - | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
548 | 550 | | |
| 551 | + | |
549 | 552 | | |
550 | 553 | | |
551 | 554 | | |
| |||
0 commit comments