[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241223141550.638616-19-yukaixiong@huawei.com>
Date: Mon, 23 Dec 2024 22:15:37 +0800
From: Kaixiong Yu <yukaixiong@...wei.com>
To: <akpm@...ux-foundation.org>, <mcgrof@...nel.org>
CC: <ysato@...rs.sourceforge.jp>, <dalias@...c.org>,
<glaubitz@...sik.fu-berlin.de>, <luto@...nel.org>, <tglx@...utronix.de>,
<mingo@...hat.com>, <bp@...en8.de>, <dave.hansen@...ux.intel.com>,
<hpa@...or.com>, <viro@...iv.linux.org.uk>, <brauner@...nel.org>,
<jack@...e.cz>, <kees@...nel.org>, <j.granados@...sung.com>,
<willy@...radead.org>, <Liam.Howlett@...cle.com>, <vbabka@...e.cz>,
<lorenzo.stoakes@...cle.com>, <trondmy@...nel.org>, <anna@...nel.org>,
<chuck.lever@...cle.com>, <jlayton@...nel.org>, <neilb@...e.de>,
<okorniev@...hat.com>, <Dai.Ngo@...cle.com>, <tom@...pey.com>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <paul@...l-moore.com>, <jmorris@...ei.org>,
<linux-sh@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-fsdevel@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-nfs@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-security-module@...r.kernel.org>, <dhowells@...hat.com>,
<haifeng.xu@...pee.com>, <baolin.wang@...ux.alibaba.com>,
<shikemeng@...weicloud.com>, <dchinner@...hat.com>, <bfoster@...hat.com>,
<souravpanda@...gle.com>, <hannes@...xchg.org>, <rientjes@...gle.com>,
<pasha.tatashin@...een.com>, <david@...hat.com>, <ryan.roberts@....com>,
<ying.huang@...el.com>, <yang@...amperecomputing.com>,
<zev@...ilderbeest.net>, <serge@...lyn.com>, <vegard.nossum@...cle.com>,
<wangkefeng.wang@...wei.com>
Subject: [PATCH v4 -next 02/15] mm: filemap: move sysctl to mm/filemap.c
This moves the filemap related sysctl to mm/filemap.c, and
removes the redundant external variable declaration.
Signed-off-by: Kaixiong Yu <yukaixiong@...wei.com>
Reviewed-by: Kees Cook <kees@...nel.org>
---
v4:
- const qualify struct ctl_table filemap_sysctl_table
v3:
- change the title
---
---
include/linux/mm.h | 2 --
kernel/sysctl.c | 8 --------
mm/filemap.c | 18 +++++++++++++++---
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d61b9c7a3a7b..dbdf8950d681 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -40,8 +40,6 @@ struct user_struct;
struct pt_regs;
struct folio_batch;
-extern int sysctl_page_lock_unfairness;
-
void mm_core_init(void);
void init_mm_internals(void);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f1ab251fc2d0..23c8db80da5d 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2079,14 +2079,6 @@ static struct ctl_table vm_table[] = {
.extra1 = SYSCTL_ONE,
.extra2 = SYSCTL_FOUR,
},
- {
- .procname = "page_lock_unfairness",
- .data = &sysctl_page_lock_unfairness,
- .maxlen = sizeof(sysctl_page_lock_unfairness),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- },
#ifdef CONFIG_MMU
{
.procname = "max_map_count",
diff --git a/mm/filemap.c b/mm/filemap.c
index 899dab55d235..bb7aff8960a4 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -47,6 +47,7 @@
#include <linux/splice.h>
#include <linux/rcupdate_wait.h>
#include <linux/sched/mm.h>
+#include <linux/sysctl.h>
#include <linux/fsnotify.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
@@ -1069,6 +1070,19 @@ static wait_queue_head_t *folio_waitqueue(struct folio *folio)
return &folio_wait_table[hash_ptr(folio, PAGE_WAIT_TABLE_BITS)];
}
+/* How many times do we accept lock stealing from under a waiter? */
+static int sysctl_page_lock_unfairness = 5;
+static const struct ctl_table filemap_sysctl_table[] = {
+ {
+ .procname = "page_lock_unfairness",
+ .data = &sysctl_page_lock_unfairness,
+ .maxlen = sizeof(sysctl_page_lock_unfairness),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ }
+};
+
void __init pagecache_init(void)
{
int i;
@@ -1077,6 +1091,7 @@ void __init pagecache_init(void)
init_waitqueue_head(&folio_wait_table[i]);
page_writeback_init();
+ register_sysctl_init("vm", filemap_sysctl_table);
}
/*
@@ -1224,9 +1239,6 @@ static inline bool folio_trylock_flag(struct folio *folio, int bit_nr,
return true;
}
-/* How many times do we accept lock stealing from under a waiter? */
-int sysctl_page_lock_unfairness = 5;
-
static inline int folio_wait_bit_common(struct folio *folio, int bit_nr,
int state, enum behavior behavior)
{
--
2.34.1
Powered by blists - more mailing lists