linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muchun Song <muchun.song@linux.dev>
To: "Michal Koutný" <mkoutny@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Dave Chinner <david@fromorbit.com>,
	Qi Zheng <zhengqi.arch@bytedance.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Jan Kara <jack@suse.cz>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: Do not allocate shrinker info with cgroup.memory=nokmem
Date: Thu, 26 Feb 2026 15:19:02 +0800	[thread overview]
Message-ID: <2F51915F-374B-4C69-8853-D980908BFDE8@linux.dev> (raw)
In-Reply-To: <20260225-cgroup-ml-nokmem-shrinker-v1-1-d703899bdda4@suse.com>



> On Feb 26, 2026, at 02:38, Michal Koutný <mkoutny@suse.com> wrote:
> 
> There'd be no work for memcg-aware shrinkers when kernel memory is not
> accounted per cgroup, so we can skip allocating per memcg shrinker data.
> This saves some memory, avoids holding shrinker_mutex with O(nr_memcgs)
> and saves work in shrink_slab_memcg().
> 
> Then there are SHRINKER_NONSLAB shrinkers which handle non-kernel memory
> so nokmem should not disable their per-memcg behavior. Such shrinkers
> (e.g.  deferred_split_shrinker) still need access to per-memcg data (see
> also commit 0a432dcbeb32e ("mm: shrinker: make shrinker not depend on
> memcg kmem")).
> 
> The savings with this patch come on container hosts that create many
> superblocks (each with own shrinker) but tracking and processing
> per-memcg data is pointless with nokmem (shrink_slab_memcg() is
> partially guarded with !memcg_kmem_online already).
> 
> The patch uses "boottime" predicate mem_cgroup_kmem_disabled() (not
> memcg_kmem_online()) to avoid mistakenly un-MEMCG_AWARE-ing shrinkers
> registered before first non-root memcg is mkdir'd.
> 
> Signed-off-by: Michal Koutný <mkoutny@suse.com>

Reviewed-by: Muchun Song <muchun.song@linux.dev>

Thanks



      parent reply	other threads:[~2026-02-26  7:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 18:38 Michal Koutný
2026-02-26  0:25 ` Roman Gushchin
2026-02-26  7:16 ` Qi Zheng
2026-02-26  7:19 ` Muchun Song [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2F51915F-374B-4C69-8853-D980908BFDE8@linux.dev \
    --to=muchun.song@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mkoutny@suse.com \
    --cc=roman.gushchin@linux.dev \
    --cc=zhengqi.arch@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox