public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH V2 0/4] record non-slab shrinkers for non-root memcgs when kmem is disabled
@ 2026-03-10  3:12 Haifeng Xu
  2026-03-10  3:12 ` [PATCH V2 1/4] mm: shrinker: add one more parameter in shrinker_id() Haifeng Xu
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Haifeng Xu @ 2026-03-10  3:12 UTC (permalink / raw)
  To: akpm, david, roman.gushchin
  Cc: zhengqi.arch, muchun.song, linux-mm, linux-kernel, Haifeng Xu

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 seconds to 69 seconds. We test it based on
stable kernel 6.6.102.

Changes since V1:
- reuse shrinker_id() to retrieve the id of shrinker, this also fix the
  build error without CONFIG_MEMCG.

https://lore.kernel.org/all/20260306075757.198887-1-haifeng.xu@shopee.com/

Haifeng Xu (4):
  mm: shrinker: add one more parameter in shrinker_id()
  mm: shrinker: move shrinker_id() code block below memcg_kmem_online()
  mm: shrinker: optimize the allocation of shrinker_info when setting
    cgroup_memory_nokmem
  mm: shrinker: remove unnecessary check in shrink_slab_memcg()

 include/linux/memcontrol.h | 194 +++++++++++++++++++------------------
 include/linux/shrinker.h   |   3 +
 mm/huge_memory.c           |   4 +-
 mm/shrinker.c              | 133 +++++++++++++++++++++----
 4 files changed, 217 insertions(+), 117 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-03-13  3:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10  3:12 [PATCH V2 0/4] record non-slab shrinkers for non-root memcgs when kmem is disabled Haifeng Xu
2026-03-10  3:12 ` [PATCH V2 1/4] mm: shrinker: add one more parameter in shrinker_id() Haifeng Xu
2026-03-10  3:12 ` [PATCH V2 2/4] mm: shrinker: move shrinker_id() code block below memcg_kmem_online() Haifeng Xu
2026-03-10  3:12 ` [PATCH V2 3/4] mm: shrinker: optimize the allocation of shrinker_info when setting cgroup_memory_nokmem Haifeng Xu
2026-03-10 11:05   ` Usama Arif
2026-03-11  2:21     ` Haifeng Xu
2026-03-11 22:14   ` Dave Chinner
     [not found]     ` <bc08d009-fa43-44d0-880f-a37cc200a3b9@shopee.com>
2026-03-12  5:52       ` Dave Chinner
2026-03-13  3:04         ` Haifeng Xu
2026-03-10  3:12 ` [PATCH V2 4/4] mm: shrinker: remove unnecessary check in shrink_slab_memcg() Haifeng Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox