From patchwork Thu Oct 10 15:22:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13830194 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 2004ECF11F8 for ; Thu, 10 Oct 2024 14:11:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE78F6B0089; Thu, 10 Oct 2024 10:11:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A70646B008A; Thu, 10 Oct 2024 10:11:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EB016B008C; Thu, 10 Oct 2024 10:11:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 707746B0089 for ; Thu, 10 Oct 2024 10:11:49 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 68F6E40682 for ; Thu, 10 Oct 2024 14:11:46 +0000 (UTC) X-FDA: 82657881096.18.C020249 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf21.hostedemail.com (Postfix) with ESMTP id 9B05A1C0018 for ; Thu, 10 Oct 2024 14:11:43 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.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=1728569437; 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=cxy8UHV1XeChHvv+QQZ0+LM90KKX8jwmk3+kNPJFrGM=; b=H2LnS+LzDN4UvoL9wIaVU4JC0Hu7Xi2H7pL2R+SvOoEL3PcMhN19SMykyjErMgmQt9727O deiQie1I5HBfZuXzhq31SPzizyx0HdspcT2hJ2B38T6QRe0pFU4gGPZl9KseNLryOP7g9N kVxS3UnBTM7Z0qANMXrr1ms0PZlvWdU= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.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=1728569437; a=rsa-sha256; cv=none; b=BRrbo0qZJwo/ChS58jZ64ZOyKiAUbva0c/EzV8KPCt8pSWWdYVRfUOekY8p6j8aaH/A7Ae NEU3mvi3EvHcYqzpehI2aBFe+vyJnUszlPIzkFzaKk9Xg+npiAxt9dMyptDJSRnM0AjYmY tzt9GZxYZSocAxM0FoN/peXLqhIqiSU= Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4XPWqs4mTgz2DdD3; Thu, 10 Oct 2024 22:10:33 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 5C4C61400DC; Thu, 10 Oct 2024 22:11:40 +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; Thu, 10 Oct 2024 22:11:37 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v3 -next 03/15] mm: swap: move sysctl to mm/swap.c Date: Thu, 10 Oct 2024 23:22:03 +0800 Message-ID: <20241010152215.3025842-4-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010152215.3025842-1-yukaixiong@huawei.com> References: <20241010152215.3025842-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 9B05A1C0018 X-Stat-Signature: 3k3zqzkdee3ucsgme9i51h1pcxe78m48 X-HE-Tag: 1728569503-397648 X-HE-Meta: U2FsdGVkX19755B4LJvX9sK2wtaoc7Cei8kV4agw4CAmc6lbYImZuHj92ysCX7T8cdhkf7F+EdRuyQd338Uo1r8BFr+vUMzg0ErETO5owdsR03TfjQJIxg072Rv1nkXxV1R9sqcwr1sebg+QAcYcTtULk5DI02IBgXKb0fPXlxxNfaikb2dsG9v0DmrlNfrx+FXoRZoRP7rt3kXihgpXxMDv+Y/XYI/trsl3itC2BPll1YqHxmIimbn78Eq7KDEHDWFqqtph77rr316EVkHY+hYmorcqMEqPtpT+d4/zHhlkkpmHeZo0xWNoI/+mF96DprtudnxCH9YISlEjpIRm2ZSajazEyFQLVpf3CYaAhrT5QC7d9jnhI+ks6fWTFEYd61MKDongMSpj3D6WyT+yNm1nwHRZTJ+13MvjIvJDFRNzPo3G62G1afFE+b8A66pY/qUHUSfSxheYFSENieTk7WhMvcmpbAMdY/FYpp3omJV+OnpkpTWYp4H4cgWLySfbcOx9fqbtbYRaEo+/jylxwyrnu4uH0Qwy1THuf6L2/7ILZ8SsSxQ/9P84ls6lRinlEzKII9U46BpH4zAY1DRnOqKh/MZldz6RsBGubFscEDx4xRLiN4l3flohkVjOs6khEZNe82I7ixD43M8b7WKKv+w9fg0hNjOiHdsYF0c17/vujQqm+yjwvcrcstuWLXZtgPM3MNq/S3F9vzSGeU0NXtoVCgCoOBOWfflPT3RbLN1IasOcjGU3MuZLfM+g+g9LY1ZeNQPRJUcy43ZLC+RVzNBoD3qcONcEWG/9Xbzk3yrkWy59hfsWnPCSXA9c3VgfpY5zg7chiNasPYGGKdECtrYFjW8ZdF6mF27aO5xfblHMaJWFID2pQNod/YhlAMsTGbKZGbNKXYuvYxvl5Jt9OK9KFe4ZJKhqjZ2HFn8BWl0dsuGXgF6hQhHb7gyOcvRUrGRzalzaKeT8jKPKOfn k/xtwZiQ 36W+wWp/xDKg7/BE1p0FDMSOJHaIWsn5m6MKiDeyooYpTloT5Sk8iojEwsoXnhvSdYpx9xIlC7J02dpEfm9PwJiQEQ+hWwg4DmqTiTpxp3IzoYbYQVBfEzwYZoN2ACpONF3ZZw6EC2KGo/HN5fMpHsYULl6KkkD98xFPM4zW8vwmGPsI= 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 to mm/swap.c . Removes the redundant external variable declaration and unneeded include(linux/swap.h). Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- v3: - change the title --- 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 a3c3a7d64407..7c46de4290da 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 835bdf324b76..2f7d415e66a3 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 ad2f121de970..274dcc6219a0 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 */