From patchwork Mon Aug 26 12:04:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777706 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 CC9BAC5321E for ; Mon, 26 Aug 2024 12:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC7FE6B04C0; Mon, 26 Aug 2024 08:05:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C51B76B04C2; Mon, 26 Aug 2024 08:05:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACABA6B04C1; Mon, 26 Aug 2024 08:05:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8D2D36B049E for ; Mon, 26 Aug 2024 08:05:39 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EADF081057 for ; Mon, 26 Aug 2024 12:05:38 +0000 (UTC) X-FDA: 82494267156.03.004DD87 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf02.hostedemail.com (Postfix) with ESMTP id 5AFF580026 for ; Mon, 26 Aug 2024 12:05:35 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 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=1724673850; 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=OC2phavSMH/blJf41JUN2nP7ccWaEyK+m9NZkfqILvU=; b=DiO7JQJ5Px6pSmZI3W9PQUh7KItimwivhyUwTUSqJLRr5oMLxawSov/Or0IXiEXUIwdirn QWhzD69r0JdqIiGT8Ta34BPITtHYoqdELLEYJCGpZ2VfUjB1BkPYLx0CygdiW6dn5ZWUkE qGj75Ju/Xxhm/d5CluisP/5ouq9Q1zc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673850; a=rsa-sha256; cv=none; b=49muWfsVv1dk/Wf/t6+JiY8s2hhvk6k8Fndrs1wrMR2ApAXU2lUtU5E/15B+Vh6FkoxFLI 84acf0yLDuWj7K9Bvhy7TZDL9IX15FdGXQHV3E7CaKboueEhVrFzNYWfNngPqg5e4SiN0p M8fCo6h4Wr1LJSGOeLLv4AtI++nVo9g= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Wsq9S4GSfz14G6b; Mon, 26 Aug 2024 20:04:44 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 2F1091800D0; Mon, 26 Aug 2024 20:05:30 +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:27 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 04/15] mm: vmscan: move vmscan sysctls to its own file Date: Mon, 26 Aug 2024 20:04:38 +0800 Message-ID: <20240826120449.1666461-5-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: s4ywm67cr3nifkwrjb99ogwhsy39bcu4 X-Rspamd-Queue-Id: 5AFF580026 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1724673935-364322 X-HE-Meta: U2FsdGVkX18Slnq6A4w+haQDrzTqVMLRYlQZYtfYmPFD4tHBIAKU6Ej3iT/6sqbHWhGWm5XhLRSJv2CxPN2JbH0pueL+IIqAMc223VG3ieF7Jh/wHHjsQogogOTSRRiNl07a8t8Mq8jAoAwN3jIccSjbbnxilRYlM3UIIvwpt3YOch3X/XhoqD1O6xNGsVQJ9wfYghhklRN2ZSuNmJ15mTGvTkmPvIwu5AD9uYdUsl8vs88/g3/VigDse6dUEuacz+1k7sgDOFmb2p/jZEhq61oz6um9KPaRjvsrNzREtUnDqX6ml7A3BlKnMaJl5oHSrshhdYnFapyF3GVHwk1M/4w5aRfgJI/b54DNlov8+N6T21VqRIrAbfn6azE+ZGf+iB1I2Agf/no0BJi4VMHZSzi8XmHzrTWFZZJFiy40uAWjtnhogKxk+7EUwOrDPmulvGICLwk+5FPwICr482nBs80hr8tfXURtm02qopoMcRaNmuJQ/L8GeBBZCO1kD35A3yGQtqFP4FjzZlz5xSbpKuHMp/KI+F/DWrBtzrQ1nmzamqq5xTYjcT7RDMwNtAmrw2ygoW6/p8CoAkDi5DUnOrnmhoSUHaCNNzSvFDmwjTPBaRZEcSAuDKtjfLlF1tCn5GXZA0hKMROhT64XNpH8bMd0ZMVTmwTK/rP5bxNwKJGh6aS/AmRuTd65LbyxvrvMjLoGMch/Vd/+4qykjc/r4rhl+zh98RB3hKchYmBOmIoJOkN+1YpYsFYwSydQ7/9AsVbj2X6TaiIMyzlh+ltogxY/01rzrXCW99QS7ghqLgLOrOuhMESueXR97BHZrq+XiUOoTExaCsKb0CFnkDyhFdpdlAZ4lcKdHei9wU82rA+UY0KLgTYlpZ2uZuCt60POGOsk2LeP1kxDlIwSRWKg33VITYywIUqE6HNXrj0HeZdaahQea07zgUUfb7pbSltheeRQQTC74jQuuqgmezI 6ga8vvOn ouNd1ci6Yuzw3PZEmfHcvBEImYmGl4K3zKbK/uyMyJFZ9QBshaEVtSN6JHwK9NtafYnyPcF5fQxgW9MFxKK11glJDOvJ35YaVLTcRDmy+GRhvV8HPAV9rZtXQZ6+ZSrKkDk5zE/Ns6PTVs8kZ2Wdhham2yg== 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: This moves vm_swappiness and zone_reclaim_mode to its own file, as part of the kernel/sysctl.c cleaning, also moves some external variable declarations and function declarations from include/linux/swap.h into mm/internal.h. Signed-off-by: Kaixiong Yu --- include/linux/swap.h | 9 --------- kernel/sysctl.c | 19 ------------------- mm/internal.h | 10 ++++++++++ mm/vmscan.c | 23 +++++++++++++++++++++++ 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 248db1dd7812..7e6287e64118 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -424,19 +424,10 @@ extern int vm_swappiness; long remove_mapping(struct address_space *mapping, struct folio *folio); #ifdef CONFIG_NUMA -extern int node_reclaim_mode; extern int sysctl_min_unmapped_ratio; extern int sysctl_min_slab_ratio; -#else -#define node_reclaim_mode 0 #endif -static inline bool node_reclaim_enabled(void) -{ - /* Is any node_reclaim_mode bit set? */ - return node_reclaim_mode & (RECLAIM_ZONE|RECLAIM_WRITE|RECLAIM_UNMAP); -} - void check_move_unevictable_folios(struct folio_batch *fbatch); extern void __meminit kswapd_run(int nid); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 9fad501311a1..184d39944e16 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2061,15 +2061,6 @@ static struct ctl_table vm_table[] = { .proc_handler = dirtytime_interval_handler, .extra1 = SYSCTL_ZERO, }, - { - .procname = "swappiness", - .data = &vm_swappiness, - .maxlen = sizeof(vm_swappiness), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_TWO_HUNDRED, - }, { .procname = "drop_caches", .data = &sysctl_drop_caches, @@ -2117,16 +2108,6 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ZERO, }, #endif -#ifdef CONFIG_NUMA - { - .procname = "zone_reclaim_mode", - .data = &node_reclaim_mode, - .maxlen = sizeof(node_reclaim_mode), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - }, -#endif #ifdef CONFIG_MMU { .procname = "mmap_min_addr", diff --git a/mm/internal.h b/mm/internal.h index e1e139e412d1..d396b201e636 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1031,9 +1031,13 @@ static inline void mminit_verify_zonelist(void) #define NODE_RECLAIM_SUCCESS 1 #ifdef CONFIG_NUMA +extern int node_reclaim_mode; + extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int); extern int find_next_best_node(int node, nodemask_t *used_node_mask); #else +#define node_reclaim_mode 0 + static inline int node_reclaim(struct pglist_data *pgdat, gfp_t mask, unsigned int order) { @@ -1045,6 +1049,12 @@ static inline int find_next_best_node(int node, nodemask_t *used_node_mask) } #endif +static inline bool node_reclaim_enabled(void) +{ + /* Is any node_reclaim_mode bit set? */ + return node_reclaim_mode & (RECLAIM_ZONE|RECLAIM_WRITE|RECLAIM_UNMAP); +} + /* * mm/memory-failure.c */ diff --git a/mm/vmscan.c b/mm/vmscan.c index 283e3f9d652b..38b58a40d25b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7365,6 +7365,28 @@ void __meminit kswapd_stop(int nid) pgdat_kswapd_unlock(pgdat); } +static struct ctl_table vmscan_sysctl_table[] = { + { + .procname = "swappiness", + .data = &vm_swappiness, + .maxlen = sizeof(vm_swappiness), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_TWO_HUNDRED, + }, +#ifdef CONFIG_NUMA + { + .procname = "zone_reclaim_mode", + .data = &node_reclaim_mode, + .maxlen = sizeof(node_reclaim_mode), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + } +#endif +}; + static int __init kswapd_init(void) { int nid; @@ -7372,6 +7394,7 @@ static int __init kswapd_init(void) swap_setup(); for_each_node_state(nid, N_MEMORY) kswapd_run(nid); + register_sysctl_init("vm", vmscan_sysctl_table); return 0; }