From: tangmeng <tangmeng@uniontech.com>
To: akpm@linux-foundation.org, mcgrof@kernel.org,
keescook@chromium.org, yzaikin@google.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-fsdevel@vger.kernel.org, nizhen@uniontech.com,
zhanglianjie@uniontech.com, nixiaoming@huawei.com,
tangmeng <tangmeng@uniontech.com>
Subject: [PATCH 09/11] mm/filemap: move filemap sysctls to its own file
Date: Sun, 20 Feb 2022 14:01:49 +0800 [thread overview]
Message-ID: <20220220060149.14110-1-tangmeng@uniontech.com> (raw)
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
All filesystem syctls now get reviewed by fs folks. This commit
follows the commit of fs, move the filemap sysctls to its own file,
mm/filemap.c.
Signed-off-by: tangmeng <tangmeng@uniontech.com>
---
include/linux/mm.h | 2 --
kernel/sysctl.c | 8 --------
mm/filemap.c | 24 +++++++++++++++++++++++-
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 213cc569b192..c3c7cb58c847 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -39,8 +39,6 @@ struct anon_vma_chain;
struct user_struct;
struct pt_regs;
-extern int sysctl_page_lock_unfairness;
-
void init_mm_internals(void);
#ifndef CONFIG_NUMA /* Don't use mapnrs, do it properly */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 1a1504862f4f..b51b0b92fdc1 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2261,14 +2261,6 @@ static struct ctl_table vm_table[] = {
.proc_handler = percpu_pagelist_high_fraction_sysctl_handler,
.extra1 = SYSCTL_ZERO,
},
- {
- .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 ad8c39d90bf9..f264e7e12f59 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1235,7 +1235,29 @@ static inline bool folio_trylock_flag(struct folio *folio, int bit_nr,
}
/* How many times do we accept lock stealing from under a waiter? */
-int sysctl_page_lock_unfairness = 5;
+static int sysctl_page_lock_unfairness = 5;
+
+#ifdef CONFIG_SYSCTL
+static struct ctl_table vm_filemap_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,
+ },
+ { }
+};
+
+static __init int vm_filemap_sysctls_init(void)
+{
+ register_sysctl_init("vm", vm_filemap_table);
+ return 0;
+}
+late_initcall(vm_filemap_sysctls_init);
+#endif /* CONFIG_SYSCTL */
static inline int folio_wait_bit_common(struct folio *folio, int bit_nr,
int state, enum behavior behavior)
--
2.20.1
reply other threads:[~2022-02-20 6:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220220060149.14110-1-tangmeng@uniontech.com \
--to=tangmeng@uniontech.com \
--cc=akpm@linux-foundation.org \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=nixiaoming@huawei.com \
--cc=nizhen@uniontech.com \
--cc=yzaikin@google.com \
--cc=zhanglianjie@uniontech.com \
/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