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@xxxxxxxxxxxxx> --- 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