From patchwork Mon Aug 26 12:04:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777719 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 AD289C5321E for ; Mon, 26 Aug 2024 12:06:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 660576B0450; Mon, 26 Aug 2024 08:06:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EA616B044F; Mon, 26 Aug 2024 08:06:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C7F56B044B; Mon, 26 Aug 2024 08:06:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 10D636B0449 for ; Mon, 26 Aug 2024 08:06:06 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B7905121006 for ; Mon, 26 Aug 2024 12:06:05 +0000 (UTC) X-FDA: 82494268290.04.C027772 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf05.hostedemail.com (Postfix) with ESMTP id 2F9C5100021 for ; Mon, 26 Aug 2024 12:06:02 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 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=1724673920; a=rsa-sha256; cv=none; b=6KI3aKG3JU5kuzOK5Uhq04hyrdvxPBIVJ82q6AH3yLSR4i3OlVToyFigsEt0dSMPDmR6Cr BI21qrGNSZYL0v6WyKztuUWNBbHFO23k0wSWQYQ7roCxK/4+m3zhsIxJEZavt2LFgj3J3D rGkpv6xNcedl9CW17QLBdC7ssXmlt3Q= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 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=1724673920; 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=sXNt9YDqUtLmk0cHgRPfAA9sqVVCfXu1mKjzdspGC3c=; b=UbNvwFPkw6n8H1TXW4FY0M9i7cxv77OwTJyzQeqhT1J283w3jxl2fXyFL+kCo3ANoQYWjz QbrwwYdinqd3CbzvlR7O/zO0MTTFF5+sTra0yA3gFzGJ1e3DLZZb5DjbvAyTi8Bi6DB08G pr7Ztj1Rz/mECJfIAJb8DwcJRpH8IjU= Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Wsq7w6cqYzhYWK; Mon, 26 Aug 2024 20:03:24 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id D6E961401F0; Mon, 26 Aug 2024 20:05:27 +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; Mon, 26 Aug 2024 20:05:25 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 03/15] mm: swap: move sysctl to its own file Date: Mon, 26 Aug 2024 20:04:37 +0800 Message-ID: <20240826120449.1666461-4-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-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-Stat-Signature: mheeayjhunznzwz8ofo5ccwtha1x6t8o X-Rspamd-Queue-Id: 2F9C5100021 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724673962-222148 X-HE-Meta: U2FsdGVkX19PwTR8xw4S9OL1A6bwpbaLbY44XmpgyZlft3yPnIx87p0E7IVQow7RJvss/9vcMZJK/YkUiJ0AChzI/tk9dM6c+n9kxGfivFO0Pa7jPNMJp0oBM0N9N8Xj6wcd/sj5q7lpbCKzaR65wgE8VoVh4Buc46FD2t+slEuBL2m/IJaFuaYGLm+xvCy+iRBdfqLEANhBruNnuCiY7WEAHSD/SyYzxEKU4EDtBx6omWppA473n+hfuYnR0l4ITXfp4strG8aegRWfAwWEghgXL4O3e6i+nt1OIzC5/aFJpXvIvn1P59CCS3/cgkQ8f/lTsejmeFCrgtLcF7trS0reoBrZiy+MlrSd0L/sJj5JWWGcUsFIKT8Ors+Dt5F0i2kd+xTJfsRcKOtz+pZw4vAVJUnGEPby6+4hmz1KND3a66nvFJwynQb+jFVMM8rvo+EbHdJcAAhb9DtZtqSHQzKaHRuZZXYJbWg9sW1an5KpoMXG/pQI0msNL56R5yulY1QRCM4jNtEzuzuUL/v/NPUjficj/ZwbMIC3mZdoUx4cbGxSsCfRsYNSoh9loEbGFI1lbtKL12Kn8F/LCCwwLq+d4zj8Uxeuj9rFP5e5nU3xwiINQ9pofx2tDDV8f3sqB13v210qMZTtasa+pt6KMTTShdWVfNVMWn5wsBeBDNMndz/XeNVdOHP770wtyihuRgNsVaSiixm70ISe4/8BSnC43iHW1yD2BCiuz/5U1I6AZimYpC8srUWfCRapv/h5dzaSZjjIWS92bxW0njpYk3Dxcw7/sBMmKDkQS6H53+UOcXNePd5JUCiN2/v9wbFvo/QyqPUlqdI1c/cShRQijhaY7h2r9FrGCeuQg0zMS00lnSvMYs/pTnlDn3awbsi8u0oy/yXp+aXU80yLBvrjBKcVVn2FwLhK2CoTPK+6KpYY2y7n/J6RtdcrnDHy5CFS7UquqJg0thvCLEok/wO 0zb9mJi7 hvSIgZTuHyrYMujwaC4aE4Da3EIjskCQ02Qkrtuze5NOd858KSzKsfRNPmoj8vwavK0dVOLk7kfJZ8LIw7fWv149IuYlb5kywXpgEI8bJjvglSLBvCeDA1GONFiiOB4FPFh0ege1sipVcG8+ndckSIGK9IDM3Q/MW7/9CzhD6vBOq+7UeY3pUeoFwCA== 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 --- 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 1db4cd7136ff..ae41092f4328 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 e0dbfc98318e..f2689ad02ba4 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 */