From: Jan Kara <jack@suse.cz>
To: "yebin (H)" <yebin10@huawei.com>
Cc: Muchun Song <muchun.song@linux.dev>,
Ye Bin <yebin@huaweicloud.com>,
viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org,
david@fromorbit.com, zhengqi.arch@bytedance.com,
roman.gushchin@linux.dev, linux-mm@kvack.org
Subject: Re: [PATCH v3 0/3] add support for drop_caches for individual filesystem
Date: Mon, 16 Mar 2026 12:39:35 +0100 [thread overview]
Message-ID: <27l3ppyys6j7vto5w2qqxemekk2vvnnn4qxw3iddupdeby3dur@6ijr5wwa5gcb> (raw)
In-Reply-To: <69A6482C.6060807@huawei.com>
On Tue 03-03-26 10:32:12, yebin (H) wrote:
> On 2026/2/27 16:27, Muchun Song wrote:
> > > On Feb 27, 2026, at 16:17, yebin (H) <yebin10@huawei.com> wrote:
> > > On 2026/2/27 15:45, Muchun Song wrote:
> > > > > On Feb 27, 2026, at 15:32, yebin (H) <yebin10@huawei.com> wrote:
> > > > > On 2026/2/27 14:55, Muchun Song wrote:
> > > > > > > On Feb 27, 2026, at 14:39, yebin (H) <yebin10@huawei.com> wrote:
> > > > > > > On 2026/2/27 11:31, Muchun Song wrote:
> > > > > > > > > On Feb 27, 2026, at 10:55, Ye Bin <yebin@huaweicloud.com> wrote:
> > > > > > > > >
> > > > > > > > > From: Ye Bin <yebin10@huawei.com>
> > > > > > > > >
> > > > > > > > > In order to better analyze the issue of file system uninstallation caused
> > > > > > > > > by kernel module opening files, it is necessary to perform dentry recycling
> > > > > > > > > on a single file system. But now, apart from global dentry recycling, it is
> > > > > > > > > not supported to do dentry recycling on a single file system separately.
> > > > > > > >
> > > > > > > > Would shrinker-debugfs satisfy your needs (See Documentation/admin-guide/mm/shrinker_debugfs.rst)?
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > Muchun
> > > > > > > >
> > > > > > > Thank you for the reminder. The reclamation of dentries and nodes can meet my needs. However, the reclamation of the page cache alone does not satisfy my requirements. I have reviewed the code of shrinker_debugfs_scan_write() and found that it does not support batch deletion of all dentries/inode for all nodes/memcgs,instead, users need to traverse through them one by one, which is not very convenient. Based on my previous experience, I have always performed dentry/inode reclamation at the file system level.
> > > > > >
> > > > > > I don't really like that you're implementing another mechanism with duplicate
> > > > > > functionality. If you'd like, you could write a script to iterate through them
> > > > > > and execute it that way—I don't think that would be particularly inconvenient,
> > > > > > would it? If the iteration operation of memcg is indeed quite cumbersome, I
> > > > > > think extending the shrinker debugfs functionality would be more appropriate.
> > > > > >
> > > > > The shrinker_debugfs can be extended to support node/memcg/fs granularity reclamation, similar to the extended function of echo " 0 - X" > count /echo " - 0 X" > count /echo " - - X" > count. This only solves the problem of reclaiming dentries/inode based on a single file system. However, the page cache reclamation based on a single file system cannot be implemented by using shrinker_debugfs. If the extended function is implemented by shrinker_debugfs, drop_fs_caches can reuse the same interface and maintain the same semantics as drop_caches.
> > > >
> > > > If the inode is evicted, the page cache is evicted as well. It cannot evict page
> > > > cache alone. Why you want to evict cache alone?
> > > >
> > > The condition for dentry/inode to be reclaimed is that there are no
> > > references to them. Therefore, relying on inode reclamation for page
> > > cache reclamation has limitations. Additionally, there is currently no
> >
> > What limit?
> >
> Perhaps I didn't explain it clearly earlier. What I want to achieve is
> the ability to perform memory reclamation (pagecache/dentry/inode)
> based on a single file system. In the current network environment, when
> troubleshooting issues, I want to control the impact of operations and
> only perform memory reclamation on specific file systems. Therefore,
> some files might be in an occupied state, and relying on dentry/inode
> to reclaim pagecache will not achieve the desired effect. Additionally,
> I have encountered some users who periodically run `drop_caches`,
> mainly to clear the pagecache. If we rely on dentry/inode to release
> resources, there will be issues where the pagecache cannot be fully
> cleared. This level of granularity is actually unnecessary because in
> some scenarios, users know which partitions they use more frequently,
> so they only need to clear the pagecache for specific partitions.
Let me revive this thread :) I agree with Ye Bin - the more interesting
part of this functionality is actually giving userspace a way to
effectively trigger drop_pagecache_sb() only for one superblock and inode
/ dentry shrinkers have no chance to do that. In particular because for
example drop_pagecache_sb() will also discard page cache of currently open
files but the inodes / dentries are used (struct file pins them in memory)
so shrinker doesn't even consider them.
I don't have a strong preference whether the API for triggering page cache
reclaim for one sb will be through /proc/sys/vm/<some_new_file> or through
debugfs (possibly <debugfs>/shrinkers/page_cache or something like that)
but this functionality definitely cannot be achieved by just triggering
some shrinkers.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
prev parent reply other threads:[~2026-03-16 11:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 2:55 Ye Bin
2026-02-27 2:55 ` [PATCH v3 1/3] mm/vmscan: introduce drop_sb_dentry_inode() helper Ye Bin
2026-02-27 2:55 ` [PATCH v3 2/3] sysctl: add support for drop_caches for individual filesystem Ye Bin
2026-02-27 2:55 ` [PATCH v3 3/3] Documentation: add instructions for using 'drop_fs_caches sysctl' sysctl Ye Bin
2026-02-27 3:31 ` [PATCH v3 0/3] add support for drop_caches for individual filesystem Muchun Song
2026-02-27 6:39 ` yebin (H)
2026-02-27 6:50 ` Qi Zheng
2026-02-27 7:18 ` yebin (H)
2026-02-27 6:55 ` Muchun Song
2026-02-27 7:32 ` yebin (H)
2026-02-27 7:45 ` Muchun Song
2026-02-27 8:17 ` yebin (H)
2026-02-27 8:27 ` Muchun Song
2026-02-27 9:02 ` yebin (H)
2026-03-03 2:32 ` yebin (H)
2026-03-16 11:39 ` Jan Kara [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=27l3ppyys6j7vto5w2qqxemekk2vvnnn4qxw3iddupdeby3dur@6ijr5wwa5gcb \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=viro@zeniv.linux.org.uk \
--cc=yebin10@huawei.com \
--cc=yebin@huaweicloud.com \
--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