From: Qi Zheng <qi.zheng@linux.dev>
To: Usama Arif <usama.arif@linux.dev>,
brauner@kernel.org, jack@suse.cz, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
linux-mm@kvack.org
Cc: hughd@google.com, boris@bur.io, clm@fb.com, dsterba@suse.com,
linux-btrfs@vger.kernel.org, cem@kernel.org,
linux-xfs@vger.kernel.org, shakeel.butt@linux.dev,
hannes@cmpxchg.org, riel@surriel.com, kernel-team@meta.com
Subject: Re: [PATCH] fs: push nr_cached_objects memcg gating into individual filesystems
Date: Tue, 14 Jul 2026 18:56:29 +0800 [thread overview]
Message-ID: <3b85c8ec-f49a-45be-8e40-fe729c908e0f@linux.dev> (raw)
In-Reply-To: <20260714101454.1202449-1-usama.arif@linux.dev>
On 7/14/26 6:14 PM, Usama Arif wrote:
> Commit 0baad6f9b997 ("fs/super: skip non-memcg-aware nr_cached_objects
> in memcg slab shrink") added a check in fs/super.c that skips the
> ->nr_cached_objects() hook whenever the shrinker is invoked for a
> non-root memcg, because none of the current implementations (btrfs,
> xfs, shmem huge) honour sc->memcg.
>
> That policy is really a filesystem-owned property: fs/super.c should
> not encode the assumption that these hooks are never memcg-aware,
> since a future implementation might legitimately filter by sc->memcg.
> Move the check into btrfs_nr_cached_objects(), xfs_fs_nr_cached_objects()
> and shmem_unused_huge_count() so each filesystem can lift the
> restriction independently once its underlying counters/scans become
> memcg-aware, without needing a coordinated change to fs/super.c.
>
> Behaviour is unchanged: calls into these hooks from shrink_slab_memcg()
> still early-return 0 for non-root memcg contexts, keeping the shrinker
> bit clearable in each memcg's bitmap; the global (kswapd or root
> direct reclaim) path still drives them as before.
>
> Signed-off-by: Usama Arif <usama.arif@linux.dev>
> ---
> fs/btrfs/super.c | 11 +++++++++++
> fs/super.c | 19 ++-----------------
> fs/xfs/xfs_super.c | 12 ++++++++++++
> mm/shmem.c | 11 +++++++++++
> 4 files changed, 36 insertions(+), 17 deletions(-)
Looks reasonable to me. So
Acked-by: Qi Zheng <qi.zheng@linux.dev>
Thanks!
next prev parent reply other threads:[~2026-07-14 10:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 10:14 [PATCH] fs: push nr_cached_objects memcg gating into individual filesystems Usama Arif
2026-07-14 10:56 ` Qi Zheng [this message]
2026-07-14 15:20 ` Jan Kara
2026-07-14 19:41 ` Shakeel Butt
2026-07-14 22:22 ` Dave Chinner
2026-07-14 22:54 ` Shakeel Butt
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=3b85c8ec-f49a-45be-8e40-fe729c908e0f@linux.dev \
--to=qi.zheng@linux.dev \
--cc=boris@bur.io \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=kernel-team@meta.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=riel@surriel.com \
--cc=shakeel.butt@linux.dev \
--cc=usama.arif@linux.dev \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.