diff options
| author | Usama Arif <usama.arif@linux.dev> | 2026-06-09 05:30:47 -0700 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-06-29 10:27:29 +0200 |
| commit | 0baad6f9b9970c6e3f1d33dbfd17d1a77702771d (patch) | |
| tree | efcfe31771927e9e0e58d6ec0bada6cb53701c62 /tools/tracing/rtla/tests/scripts/lib/git@git.tavy.me:linux.git | |
| parent | 879b3353d04d043a9e01525c520d9b81339421b2 (diff) | |
fs/super: skip non-memcg-aware nr_cached_objects in memcg slab shrink
The super_block shrinker is registered with SHRINKER_MEMCG_AWARE because its
dentry and inode LRUs are memcg-aware (via list_lru). But the optional
->nr_cached_objects() hooks that the shrinker also drives are not memcg-aware:
btrfs extent maps and xfs inode reclaim operate on filesystem-global
state, and shmem's unused-huge shrinker walks a per-superblock shrinklist.
None of them filter by sc->memcg.
The mismatch shows up under memcg-heavy slab reclaim. shrink_slab_memcg()
calls do_shrink_slab() once per (memcg, NUMA node) pair for every memcg
whose bit is set in the per-superblock shrinker bitmap, which on a busy
host means hundreds of calls per reclaim pass. Each scan queues the same
global shrinker work item that's already kicked from the root path.
Because btrfs/xfs global count is typically non-zero on any in-use filesystem,
the returned total stays positive even if a memcg's own dentry/inode LRUs
are empty. shrink_slab_memcg() therefore never clears the SB shrinker bit
in the memcg bitmap, so subsequent reclaim passes from the same memcg
re-enter super_cache_count() and pay for the global counter walk again.
Restrict ->nr_cached_objects() to the global shrink path (sc->memcg NULL
or root). The memcg-aware dentry/inode LRUs keep being counted and
scanned per memcg as before; only the global fs-specific hooks are skipped.
The root/global shrink path still drives those hooks; only their
invocation from non-root memcg slab reclaim is removed.
Signed-off-by: Usama Arif <usama.arif@linux.dev>
Link: https://patch.msgid.link/20260609123047.1948242-1-usama.arif@linux.dev
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/tracing/rtla/tests/scripts/lib/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
