From: Huang Shijie <huangsj@hygon.cn>
To: <viro@zeniv.linux.org.uk>, <brauner@kernel.org>
Cc: <zhongyuan@hygon.cn>, <fangbaoshun@hygon.cn>,
<yingzhiwei@hygon.cn>, <jack@suse.cz>, <dev.jain@arm.com>,
<ljs@kernel.org>, <adobriyan@gmail.com>,
<akpm@linux-foundation.org>, <hpa@zytor.com>,
<ryan.roberts@arm.com>, <mjguzik@gmail.com>,
<joel.granados@kernel.org>, <jannh@google.com>, <oleg@redhat.com>,
<aleksa@amutable.com>, <legion@kernel.org>, <kees@kernel.org>,
<joannelkoong@gmail.com>, <tj@kernel.org>,
<libaokun@linux.alibaba.com>, <ebiggers@kernel.org>,
<sandeen@redhat.com>, <linux-fsdevel@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Huang Shijie <huangsj@hygon.cn>
Subject: [RFC PATCH v2 1/3] fs/drop_caches: skip filesystems without page cache
Date: Sun, 20 Sep 2026 15:28:09 +0800 [thread overview]
Message-ID: <20260920072811.2064247-2-huangsj@hygon.cn> (raw)
In-Reply-To: <20260920072811.2064247-1-huangsj@hygon.cn>
Add a new flag SB_I_NO_PAGECACHE for superblock.
Skip scanning the inode lists of filesystems that have no page cache
in drop_pagecache_sb(), as indicated by the SB_I_NO_PAGECACHE flag.
This patch only changes the procfs.
Signed-off-by: Huang Shijie <huangsj@hygon.cn>
---
fs/drop_caches.c | 3 +++
fs/proc/root.c | 2 +-
include/linux/fs/super_types.h | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index 49f56a598ecb..27caf748b3c5 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -20,6 +20,9 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused)
{
struct inode *inode, *toput_inode = NULL;
+ if (sb->s_iflags & SB_I_NO_PAGECACHE)
+ return;
+
spin_lock(&sb->s_inode_list_lock);
list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
spin_lock(&inode->i_lock);
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 99adddfeb4a4..d45f5af5ab53 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -266,7 +266,7 @@ static int proc_fill_super(struct super_block *s, struct fs_context *fc)
return ret;
/* User space would break if executables or devices appear on proc */
- s->s_iflags |= SB_I_NOEXEC | SB_I_NODEV;
+ s->s_iflags |= SB_I_NOEXEC | SB_I_NODEV | SB_I_NO_PAGECACHE;
s->s_flags |= SB_NODIRATIME | SB_NOSUID | SB_NOEXEC;
s->s_blocksize = 1024;
s->s_blocksize_bits = 10;
diff --git a/include/linux/fs/super_types.h b/include/linux/fs/super_types.h
index ecd96aeb1cee..1a596caf58a8 100644
--- a/include/linux/fs/super_types.h
+++ b/include/linux/fs/super_types.h
@@ -352,5 +352,6 @@ struct super_block {
#define SB_I_NOIDMAP 0x00002000 /* No idmapped mounts on this superblock */
#define SB_I_ALLOW_HSM 0x00004000 /* Allow HSM events on this superblock */
#define SB_I_NO_DATA_INTEGRITY 0x00008000 /* fs cannot guarantee data persistence on sync */
+#define SB_I_NO_PAGECACHE 0x00010000 /* this file system has no page cache */
#endif /* _LINUX_FS_SUPER_TYPES_H */
--
2.53.0
next prev parent reply other threads:[~2026-09-20 7:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-20 7:28 [RFC PATCH v2 0/3] fs/proc: split the inode list for procfs Huang Shijie
2026-09-20 7:28 ` Huang Shijie [this message]
2026-09-20 7:28 ` [RFC PATCH v2 2/3] fs/super: introduce a helper sb_inodes_empty() Huang Shijie
2026-09-20 7:28 ` [RFC PATCH v2 3/3] fs/proc: split the inode list Huang Shijie
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=20260920072811.2064247-2-huangsj@hygon.cn \
--to=huangsj@hygon.cn \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aleksa@amutable.com \
--cc=brauner@kernel.org \
--cc=dev.jain@arm.com \
--cc=ebiggers@kernel.org \
--cc=fangbaoshun@hygon.cn \
--cc=hpa@zytor.com \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=joannelkoong@gmail.com \
--cc=joel.granados@kernel.org \
--cc=kees@kernel.org \
--cc=legion@kernel.org \
--cc=libaokun@linux.alibaba.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=mjguzik@gmail.com \
--cc=oleg@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=sandeen@redhat.com \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yingzhiwei@hygon.cn \
--cc=zhongyuan@hygon.cn \
/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
all inboxes | Powered by JetHome®