From: cgel.zte@gmail.com
To: viro@zeniv.linux.org.uk, hughd@google.com
Cc: ran.xiaokai@zte.com.cn, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] drop caches: skip tmpfs and ramfs
Date: Fri, 24 Jun 2022 18:21:21 +0000 [thread overview]
Message-ID: <20220624182121.995294-1-ran.xiaokai@zte.com.cn> (raw)
From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
All tmpfs and ramfs pages have PG_dirty bit set
once they are allocated and added to the pagecache。So pages
can not be freed from tmpfs or ramfs. So skip tmpfs and ramfs
when drop caches.
Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
---
fs/drop_caches.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index e619c31b6bd9..600c043c1eb7 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -10,6 +10,7 @@
#include <linux/writeback.h>
#include <linux/sysctl.h>
#include <linux/gfp.h>
+#include <linux/magic.h>
#include "internal.h"
/* A global variable is a bit ugly, but it keeps the code simple */
@@ -19,6 +20,9 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused)
{
struct inode *inode, *toput_inode = NULL;
+ if (sb->s_magic == TMPFS_MAGIC || sb->s_magic == RAMFS_MAGIC)
+ 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.15.2
next reply other threads:[~2022-06-24 18:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-24 18:21 cgel.zte [this message]
2022-06-25 9:19 ` Christoph Hellwig
2022-06-25 9:31 ` Gao Xiang
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=20220624182121.995294-1-ran.xiaokai@zte.com.cn \
--to=cgel.zte@gmail.com \
--cc=hughd@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ran.xiaokai@zte.com.cn \
--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