From patchwork Tue Sep 3 03:29:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13787952 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 60603CA101E for ; Tue, 3 Sep 2024 03:31:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A8ABA8D0129; Mon, 2 Sep 2024 23:31:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A37F68D0119; Mon, 2 Sep 2024 23:31:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 902688D0129; Mon, 2 Sep 2024 23:31:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5D7B98D0119 for ; Mon, 2 Sep 2024 23:31:14 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E92B9C022B for ; Tue, 3 Sep 2024 03:31:13 +0000 (UTC) X-FDA: 82522001226.29.E4B89D6 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf03.hostedemail.com (Postfix) with ESMTP id 8487420006 for ; Tue, 3 Sep 2024 03:31:11 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725334248; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QuLI0KDHhsT4Cqz+63KC1p0e4yof9oOpzKduwhM9ndg=; b=MlKL/NdGTTBwgX73GZcS02TiRkVG+20adkWHtCrnkOTxe9ikeyTERJd7EjUnUd6iodqB6E sXTCwBZs8KmB9axH1FxUVLShs6TdbHKulGLoMEonxvyQY/VeSM5gUCZrjalKOKsdf/7gZW kEmEgIqnylRVmxMG1QyWTVT4wcm9krY= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725334248; a=rsa-sha256; cv=none; b=F6K98YR86DocQgfuV6UOpqsa7tDcwIdsiJyUH18gLAPJSONWY5LJEHMSXjXpMvAf2ACHpi cUm6GLHMnzmMsUfAjkMKSf4csnGMQAaEVDjY9vJ52JW+1kVm9pAhNaHzm6+g0/rytEelv3 udNBUnWtCDHxq//eXaLSHXZuWC7uXsY= Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WyWHS4qH9z20mjM; Tue, 3 Sep 2024 11:26:12 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 4B0F51402C6; Tue, 3 Sep 2024 11:31:08 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 3 Sep 2024 11:31:05 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 -next 03/15] mm: swap: move sysctl to its own file Date: Tue, 3 Sep 2024 11:29:59 +0800 Message-ID: <20240903033011.2870608-4-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240903033011.2870608-1-yukaixiong@huawei.com> References: <20240903033011.2870608-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspam-User: X-Stat-Signature: cye1dpxbyrpsopety4kfn197afnt3r4s X-Rspamd-Queue-Id: 8487420006 X-Rspamd-Server: rspam11 X-HE-Tag: 1725334271-793341 X-HE-Meta: U2FsdGVkX18PQR+YKznN1Jxute8cfASaQrfo2KyCuF6FjHxosSRkkiaJGPLmN2Q3AMblLhTcaldOWWmixWxDr141G3UCo8nJZJpdpbo6Pm2sAIdbWPlbvF/cYYMq0oWdTZ5vOrxwUSkZT7dgStMnQcOFrsmhYSdVrKLmegLXZn4RPGJ7zZzwRdEKt3sBm3hy1YKv3jirGn1+SiLxCdAZSqn9WyZGGH9slmWLojakgOAEaHl7M9j3sYOo9LQ+SZntSL1oAW7grsltD3yNOBkYLYLoflgr2dRXz0IuD5/pCxvzHytdnsWX/X462tx5/4VelgPbj7JyeasV061dpFeFa2BDgLT8SBX/EEMZYAIClNTfW4hnKXVsc+OutcP/mJhkXoIvwZC/5N1zmS79bbV05uh9ZotjL4DvV1Q2J1ThQDctSy8RkLDr2sOOp8g9T8a2yF6YG4CZJdsdeKllvHJI7LWQeSra0mDrBHWhksciNEOPzl84sW2ZB68o96m1vZzUWYMNeXXSlC5LrbSHus0wzaA7aIondCR6XhPJMcCwAK+0KQV3H4Z4SggCThGPPKGSFoAmx+I0q6tokafh1gTcW5QQWy/rrzhMTDZJq1iBn7CYCCDwX3kVNPGuAbQeO/bTUTgXH0gbOogF9sbjbc6hFi8DULfE3ShSCH251D7Ql1qp7QrqiANEtBvWbXe8eZLPdoKA623JWeuOaME2KKpddTGTdYcXARGJVGhQvb2ar0AGWSFBtH9KtSs4sK+HtbdfKjdVaXpTyKuDmuPZyRMhUYthRQRgn1tubB/jpUjyWS5hcWwSdhTS6FY1L+acl8X9i6Ccx4S3sfAwSqKKKaWHAG5Bi4hURtKSB3GCbW9WRHmhNf6syPcAidQNEU2TLtk7UF98llzxaExTgRbqGflkmeF7usBvuksNmlr8dy1BsCDh6nwJTYablr/FdiWP13Y3dNj8Iyx+pCLFHgU3nLs 4/wldpBd YSWcf0iDB/WkRmI3KdjsZKzL9/OQyXSwTFT6WD6kHXh4x2Atu4Gt3cLp8KNsY1SLivT+bufqdcfu7nYWYJ2E7tBGGiiCHyTyrUZ6A2UqhfqUduxpRoD+E8T61L4Z1MAklJ65HgwKhz0kjlCOIwAZOPwsdCwTVLgUpF6Z1vsFpvJBg41c= 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: List-Subscribe: List-Unsubscribe: The page-cluster belongs to mm/swap.c, move it into its own file. Removes the redundant external variable declaration and unneeded include(linux/swap.h). Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- include/linux/mm.h | 2 -- kernel/sysctl.c | 10 ---------- mm/swap.c | 16 +++++++++++++++- mm/swap.h | 1 + 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ca196ba1e2d8..99f3c84652d8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -75,8 +75,6 @@ static inline void totalram_pages_add(long count) } extern void * high_memory; -extern int page_cluster; -extern const int page_cluster_max; #ifdef CONFIG_SYSCTL extern int sysctl_legacy_va_layout; diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 2a875b739054..9fad501311a1 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -2054,15 +2053,6 @@ static struct ctl_table vm_table[] = { .mode = 0644, .proc_handler = overcommit_kbytes_handler, }, - { - .procname = "page-cluster", - .data = &page_cluster, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 = (void *)&page_cluster_max, - }, { .procname = "dirtytime_expire_seconds", .data = &dirtytime_expire_interval, diff --git a/mm/swap.c b/mm/swap.c index 510573d7e82e..07cbd55938e8 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -45,7 +45,7 @@ /* How many pages do we try to swap or page in/out together? As a power of 2 */ int page_cluster; -const int page_cluster_max = 31; +static const int page_cluster_max = 31; struct cpu_fbatches { /* @@ -1089,6 +1089,18 @@ void folio_batch_remove_exceptionals(struct folio_batch *fbatch) fbatch->nr = j; } +static struct ctl_table swap_sysctl_table[] = { + { + .procname = "page-cluster", + .data = &page_cluster, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = (void *)&page_cluster_max, + } +}; + /* * Perform any setup for the swap system */ @@ -1105,4 +1117,6 @@ void __init swap_setup(void) * Right now other parts of the system means that we * _really_ don't want to cluster much more */ + + register_sysctl_init("vm", swap_sysctl_table); } diff --git a/mm/swap.h b/mm/swap.h index f8711ff82f84..7283593a0d4a 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -3,6 +3,7 @@ #define _MM_SWAP_H struct mempolicy; +extern int page_cluster; #ifdef CONFIG_SWAP #include /* for swp_offset */