From patchwork Sun Feb 20 06:01:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meng Tang X-Patchwork-Id: 12752568 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B9DBC433EF for ; Sun, 20 Feb 2022 06:02:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 012EA6B0075; Sun, 20 Feb 2022 01:02:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F04676B0078; Sun, 20 Feb 2022 01:02:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF2FD6B007B; Sun, 20 Feb 2022 01:02:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id D22DB6B0075 for ; Sun, 20 Feb 2022 01:02:08 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 9B57060372 for ; Sun, 20 Feb 2022 06:02:08 +0000 (UTC) X-FDA: 79162112736.05.AD536B3 Received: from smtpbg152.qq.com (smtpbg152.qq.com [13.245.186.79]) by imf05.hostedemail.com (Postfix) with ESMTP id EFCB6100002 for ; Sun, 20 Feb 2022 06:02:05 +0000 (UTC) X-QQ-mid: bizesmtp83t1645336917tfkame2n Received: from localhost.localdomain (unknown [180.102.102.45]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 20 Feb 2022 14:01:51 +0800 (CST) X-QQ-SSF: 01400000002000B0F000B00A0000000 X-QQ-FEAT: 4LFlwc+MlXkQ8gqbBA0q6azNy4FS1Wp5//1Uq4m3wJCqupGWBCLm4SAGWY39E d+iIj+Wv2qwxluAPiItIHm2vHTu9tlW2cYh9/+NYMgheyjVewkcP5Ia8AQ6oKZPoBm8OCrn XGx+2RzTo0DYxdemrR2ynLPwTWRgT3E7ZwgvFoZUzkT8uKT5sm61ndzj4FVNF4ww1PlRxeW XjKH4OQRKd4bh6wTqC4MwRkMZOSBpycSD7ou4QzwsFSgPnPPgF43ILh/iij7P5hxrgiDKsG VfSYnxCDrK3098yCmiAhwujlQx8XSn2FdMIYs2o2auaA91PQr7gofumlnImAAAXWDShmI6n b3S9MB2w68SHzCsrEQ4wPaebW5diY714Dx+mjye X-QQ-GoodBg: 2 From: tangmeng 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 Subject: [PATCH 09/11] mm/filemap: move filemap sysctls to its own file Date: Sun, 20 Feb 2022 14:01:49 +0800 Message-Id: <20220220060149.14110-1-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EFCB6100002 X-Stat-Signature: ic74e7f6pp318dcqiuuc1xz981sgn39w Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of tangmeng@uniontech.com designates 13.245.186.79 as permitted sender) smtp.mailfrom=tangmeng@uniontech.com; dmarc=none X-Rspam-User: X-HE-Tag: 1645336925-668839 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 --- 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)