Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qi Zheng <qi.zheng@linux.dev>
To: Usama Arif <usama.arif@linux.dev>
Cc: 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, 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/super: skip non-memcg-aware nr_cached_objects in memcg slab shrink
Date: Tue, 14 Jul 2026 18:52:49 +0800	[thread overview]
Message-ID: <3f87f6af-3952-4c16-83fa-9fb77085a285@linux.dev> (raw)
In-Reply-To: <20260714101740.1270419-1-usama.arif@linux.dev>



On 7/14/26 6:17 PM, Usama Arif wrote:
> On Tue, 14 Jul 2026 10:09:26 +0800 Qi Zheng <qi.zheng@linux.dev> wrote:
> 
>> Hi Usama,
>>
>> On 7/13/26 11:34 PM, Usama Arif wrote:
>>>
>>>
>>> On 13/07/2026 14:12, Qi Zheng wrote:
>>>> Hi Usama,
>>>>
>>>> On 6/9/26 8:30 PM, Usama Arif wrote:
>>>>> 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.
>>>>
>>>> This makes sense for now, but how should we handle this if these
>>>> shrinkers are made memcg-aware in the future?
>>>>
>>>> I've recently been working on making the shmem huge shrinker
>>>> memcg-aware, but noticed my changes broke after rebasing onto the latest
>>>> tree, which led me to this patch.
>>>>
>>>> As for the shmem huge shrinker, I can work around this limitation by
>>>> making it a separate shrinker. But this feels more like an overall
>>>> design decision, effectively meaning that all nr_cached_objects are
>>>> precluded from being memcg-aware.
>>>>
>>>> Thanks,
>>>> Qi
>>>>
>>>
>>>
>>> Hi Qi,
>>>
>>> Thanks for raising this. I think the alternative is what I mentioned in
>>> https://lore.kernel.org/all/cfdb8620-ea55-4226-98bf-d006820e6270@linux.dev/
>>> move this down to the fs own callbacks instead of here. Would that
>>> be better?
>>
>> Yes, I think this is a better approach.
>>
>> Later on, shrinkers that are converted to be memcg-aware can lift this
>> restriction themselves.
>>
>> Thanks,
>> Qi
> 
> Thanks Qi, I have sent a patch to push it down to filesystems in [1].
> No functional change inteneded in there. You would have to rebase your
> patch on top of that one and remove my code in shmem specifically.

Thanks! I will rebase my patch once your patch is merged into
linux-next.

> 
> [1] https://lore.kernel.org/all/20260714101454.1202449-1-usama.arif@linux.dev/
> 
>>
>>>
>>> Thanks,
>>> Usama
>>
>>


      reply	other threads:[~2026-07-14 10:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 12:30 [PATCH] fs/super: skip non-memcg-aware nr_cached_objects in memcg slab shrink Usama Arif
2026-06-09 12:52 ` Jan Kara
2026-06-09 13:38   ` Usama Arif
2026-06-23 10:14 ` Christian Brauner
2026-06-23 18:08 ` Shakeel Butt
2026-06-24 15:18   ` Usama Arif
2026-07-13 13:12 ` Qi Zheng
2026-07-13 15:34   ` Usama Arif
2026-07-14  2:09     ` Qi Zheng
2026-07-14 10:17       ` Usama Arif
2026-07-14 10:52         ` Qi Zheng [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=3f87f6af-3952-4c16-83fa-9fb77085a285@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox