mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>,
	<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<yefan@hygon.cn>, Huang Shijie <huangsj@hygon.cn>,
	Christoph Hellwig <hch@lst.de>
Subject: [PATCH] fs/drop_caches: skip filesystems without fs writeback
Date: Wed, 23 Sep 2026 15:01:16 +0800	[thread overview]
Message-ID: <20260923070116.3226846-1-huangsj@hygon.cn> (raw)

Filesystems backed by the noop backing device (procfs, sysfs, kernfs,
tmpfs, ramfs, etc.) have no fs page-cache writeback.  Skip them in
drop_pagecache_sb() instead of walking their inode lists.

This also skips tmpfs/ramfs. tmpfs has clean folios which are
zero-filled pages from reading holes, which are trivially recreatable.

Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Huang Shijie <huangsj@hygon.cn>
---
The RFC mails:
   https://lore.kernel.org/all/arIVBpMZk5-O2AZc@infradead.org/
---
 fs/drop_caches.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index 49f56a598ecb..28c5fb9c7357 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -7,6 +7,7 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/fs.h>
+#include <linux/backing-dev.h>
 #include <linux/writeback.h>
 #include <linux/sysctl.h>
 #include <linux/gfp.h>
@@ -20,6 +21,9 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused)
 {
 	struct inode *inode, *toput_inode = NULL;
 
+	if (sb->s_bdi == &noop_backing_dev_info)
+		return;
+
 	spin_lock(&sb->s_inode_list_lock);
 	list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
 		spin_lock(&inode->i_lock);
-- 
2.53.0



             reply	other threads:[~2026-09-23  7:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  7:01 Huang Shijie [this message]
2026-09-23 11:04 ` Jan Kara
2026-09-25  6:57 ` Christoph Hellwig

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=20260923070116.3226846-1-huangsj@hygon.cn \
    --to=huangsj@hygon.cn \
    --cc=brauner@kernel.org \
    --cc=fangbaoshun@hygon.cn \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yefan@hygon.cn \
    --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®