linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kaixiong Yu <yukaixiong@huawei.com>
To: <akpm@linux-foundation.org>, <mcgrof@kernel.org>
Cc: <ysato@users.sourceforge.jp>, <dalias@libc.org>,
	<glaubitz@physik.fu-berlin.de>, <luto@kernel.org>,
	<tglx@linutronix.de>, <bp@alien8.de>,
	<dave.hansen@linux.intel.com>, <hpa@zytor.com>,
	<viro@zeniv.linux.org.uk>, <brauner@kernel.org>, <jack@suse.cz>,
	<kees@kernel.org>, <j.granados@samsung.com>,
	<willy@infradead.org>, <Liam.Howlett@oracle.com>,
	<vbabka@suse.cz>, <lorenzo.stoakes@oracle.com>,
	<trondmy@kernel.org>, <anna@kernel.org>, <chuck.lever@oracle.com>,
	<jlayton@kernel.org>, <neilb@suse.de>, <okorniev@redhat.com>,
	<Dai.Ngo@oracle.com>, <tom@talpey.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<paul@paul-moore.com>, <jmorris@namei.org>,
	<linux-sh@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-fsdevel@vger.kernel.org>, <linux-mm@kvack.org>,
	<linux-nfs@vger.kernel.org>, <netdev@vger.kernel.org>,
	<linux-security-module@vger.kernel.org>,
	<wangkefeng.wang@huawei.com>
Subject: [PATCH -next 12/15] fs: dcache: move the sysctl into its own file
Date: Mon, 26 Aug 2024 20:04:46 +0800	[thread overview]
Message-ID: <20240826120449.1666461-13-yukaixiong@huawei.com> (raw)
In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com>

The sysctl_vfs_cache_pressure belongs to fs/dcache.c, move it to
its own file from kernel/sysctl.c. As a part of fs/dcache.c cleaning,
sysctl_vfs_cache_pressure is changed to a static variable, and export
vfs_pressure_ratio with EXPORT_SYMBOL_GPL to be used by other files.
And move the unneeded include(linux/dcache.h).

Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
---
 fs/dcache.c            | 21 +++++++++++++++++++--
 include/linux/dcache.h |  7 +------
 kernel/sysctl.c        |  9 ---------
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 1af75fa68638..8717d5026cda 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -73,8 +73,13 @@
  * If no ancestor relationship:
  * arbitrary, since it's serialized on rename_lock
  */
-int sysctl_vfs_cache_pressure __read_mostly = 100;
-EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
+static int sysctl_vfs_cache_pressure __read_mostly = 100;
+
+unsigned long vfs_pressure_ratio(unsigned long val)
+{
+	return mult_frac(val, sysctl_vfs_cache_pressure, 100);
+}
+EXPORT_SYMBOL_GPL(vfs_pressure_ratio);
 
 __cacheline_aligned_in_smp DEFINE_SEQLOCK(rename_lock);
 
@@ -196,8 +201,20 @@ static struct ctl_table fs_dcache_sysctls[] = {
 	},
 };
 
+static struct ctl_table vm_dcache_sysctls[] = {
+	{
+		.procname	= "vfs_cache_pressure",
+		.data		= &sysctl_vfs_cache_pressure,
+		.maxlen		= sizeof(sysctl_vfs_cache_pressure),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= SYSCTL_ZERO,
+	},
+};
+
 static int __init init_fs_dcache_sysctls(void)
 {
+	register_sysctl_init("vm", vm_dcache_sysctls);
 	register_sysctl_init("fs", fs_dcache_sysctls);
 	return 0;
 }
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index bff956f7b2b9..c81c2e9e13df 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -508,12 +508,7 @@ static inline int simple_positive(const struct dentry *dentry)
 	return d_really_is_positive(dentry) && !d_unhashed(dentry);
 }
 
-extern int sysctl_vfs_cache_pressure;
-
-static inline unsigned long vfs_pressure_ratio(unsigned long val)
-{
-	return mult_frac(val, sysctl_vfs_cache_pressure, 100);
-}
+unsigned long vfs_pressure_ratio(unsigned long val);
 
 /**
  * d_inode - Get the actual inode of this dentry
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d638a1bac9af..6f03fc749794 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -46,7 +46,6 @@
 #include <linux/key.h>
 #include <linux/times.h>
 #include <linux/limits.h>
-#include <linux/dcache.h>
 #include <linux/syscalls.h>
 #include <linux/nfs_fs.h>
 #include <linux/acpi.h>
@@ -2024,14 +2023,6 @@ static struct ctl_table kern_table[] = {
 };
 
 static struct ctl_table vm_table[] = {
-	{
-		.procname	= "vfs_cache_pressure",
-		.data		= &sysctl_vfs_cache_pressure,
-		.maxlen		= sizeof(sysctl_vfs_cache_pressure),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec_minmax,
-		.extra1		= SYSCTL_ZERO,
-	},
 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
    (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
 	{
-- 
2.25.1



  parent reply	other threads:[~2024-08-26 12:06 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240826120559eucas1p1a1517b9f4dbeeae893fd2fa770b47232@eucas1p1.samsung.com>
2024-08-26 12:04 ` [PATCH -next 00/15] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 01/15] mm: vmstat: move sysctls to " Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 02/15] mm: filemap: move sysctl to its own file Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 03/15] mm: swap: " Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 04/15] mm: vmscan: move vmscan sysctls " Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 05/15] mm: util: move sysctls into it own files Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 06/15] mm: mmap: move sysctl into its own file Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 07/15] security: min_addr: " Kaixiong Yu
2024-08-26 22:49     ` Paul Moore
2024-08-27  1:38       ` yukaixiong
2024-08-27  1:56         ` Paul Moore
2024-08-27  2:43           ` yukaixiong
2024-08-26 12:04   ` [PATCH -next 08/15] mm: nommu: move sysctl to " Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 09/15] fs: fs-writeback: " Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 10/15] fs: drop_caches: " Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 11/15] sunrpc: use vfs_pressure_ratio() helper Kaixiong Yu
2024-08-26 12:04   ` Kaixiong Yu [this message]
2024-08-26 19:56     ` [PATCH -next 12/15] fs: dcache: move the sysctl into its own file Kees Cook
2024-09-02 11:04       ` Jan Kara
2024-09-02 11:17     ` Christian Brauner
2024-08-26 12:04   ` [PATCH -next 13/15] x86: vdso: " Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 14/15] sh: " Kaixiong Yu
2024-08-26 12:04   ` [PATCH -next 15/15] sysctl: remove unneeded include Kaixiong Yu
2024-08-26 19:57   ` [PATCH -next 00/15] sysctl: move sysctls from vm_table into its own files Kees Cook
2024-08-27  2:03     ` yukaixiong
2024-09-02  7:17   ` Joel Granados
2024-09-02 10:55     ` yukaixiong

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=20240826120449.1666461-13-yukaixiong@huawei.com \
    --to=yukaixiong@huawei.com \
    --cc=Dai.Ngo@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=anna@kernel.org \
    --cc=bp@alien8.de \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=dalias@libc.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=hpa@zytor.com \
    --cc=j.granados@samsung.com \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=jmorris@namei.org \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=luto@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=neilb@suse.de \
    --cc=netdev@vger.kernel.org \
    --cc=okorniev@redhat.com \
    --cc=pabeni@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=tglx@linutronix.de \
    --cc=tom@talpey.com \
    --cc=trondmy@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    --cc=ysato@users.sourceforge.jp \
    /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