[PATCH 0/3] record non-slab shrinkers for non-root memcgs when kmem is disabled
From: Haifeng Xu
Date: Fri Mar 06 2026 - 03:03:29 EST
When registering new shrinkers, all memcgs need to expand shrinker info
if new allocated id exceeds shrinker_nr_max. But if kmem is disabled,
only non-slab shrinkers is useful in memcg slab shrink. So in this case,
it is enough to allocate non-slab shrinker info for non-root memcg. This
can save a bit of memory and reduce the holding time of shrinker lock.
With this optimization, the finish time of pod creation in our internal
test is reduced from 150 senconds to 69 senconds. We test it based on
stable kernel 6.6.102.
Haifeng Xu (3):
mm: shrinker: introduce new function get_shrinker_id()
mm: shrinker: optimize the allocation of shrinker_info when setting
cgroup_memory_nokmem
mm: shrinker: remove unnecessary check in shrink_slab_memcg()
include/linux/shrinker.h | 3 +
mm/huge_memory.c | 21 ++++--
mm/shrinker.c | 155 +++++++++++++++++++++++++++++++++------
3 files changed, 150 insertions(+), 29 deletions(-)
--
2.43.0