From patchwork Sat Jan 11 07:07:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935832 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 BB612E7719C for ; Sat, 11 Jan 2025 07:12:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37B026B0093; Sat, 11 Jan 2025 02:12:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 32E0D6B0095; Sat, 11 Jan 2025 02:12:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 158476B0096; Sat, 11 Jan 2025 02:12:28 -0500 (EST) 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 E9B8A6B0093 for ; Sat, 11 Jan 2025 02:12:27 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 92664810BB for ; Sat, 11 Jan 2025 07:12:27 +0000 (UTC) X-FDA: 82994302734.18.3CB3016 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf13.hostedemail.com (Postfix) with ESMTP id 269AB20009 for ; Sat, 11 Jan 2025 07:12:24 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579545; 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=x0TY9YfZ+veyMYHsOyDoPIZkXGrJB3aadow7NE5NC7Q=; b=RoptC0DmX8JXWHCY4lOM9UgZlXHBotTM1TRdExd6elBvIdFPZL6D6xXzbaJ2FO0SK43KtR tb1S/iNmghFW8DYcCrbDq1rX+7zunHst2kZurw4mMr7X48U4YMEMd+6hSaPhtP9zbB9Tkj lFzEOStC9L0EK1WRPjd7o8u9Cn9SXVQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579545; a=rsa-sha256; cv=none; b=ZwB2Z8zTfNZfGg1kbv3CKbc81cQUZ5CrcZUvEd0+gLRc2L+Pb2QEDWE9mC7DcZGc4uPsgL SiTeZ7XMyiptDaBQ12hU1XTP0rN5BUa3Rhxg+/gwHX6Aa1Tg/n1i1LdkoxdkUMaEnC25AX HtotGlt05u0a2bkDgn1uQF94ehNkeeI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YVV6R4bKjzrS4r; Sat, 11 Jan 2025 15:10:39 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 9D196180064; Sat, 11 Jan 2025 15:12:20 +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; Sat, 11 Jan 2025 15:12:17 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 01/16] mm: vmstat: move sysctls to mm/vmstat.c Date: Sat, 11 Jan 2025 15:07:36 +0800 Message-ID: <20250111070751.2588654-2-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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-Queue-Id: 269AB20009 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: k1ar383hxufo7pw7xs1gex5qjo8tnn3r X-HE-Tag: 1736579544-66132 X-HE-Meta: U2FsdGVkX18POWLP8WOowxe+ICdKuv9v4vWEYu7CkdP0CA8X1NSErttF+HnXKHCZoSVeWp7f4dMT4BDGlT9hrSUehdBh31LQxoNrXj3t2LObgH5ZqsKk2QSBQ1i5wuD+rvXTEHNuQvZAuf3JPjyNh4VpySMa0jiLNVJTUzqk8R8mZtjDS0+CIc3EzHwRodXAgu7DB1pnw06Imsxp7wYwBN3LHwfKyeCURWVPFX4/bX2eGHwvcgv60Niig2t9E3g7PM4QxABHaEusXSjJoakkh3ldQRLoE81L7D5xYnxVfYzSui2G6ruWNXBmp8zGeOZVKn9DhETnRlVovmRL8FYVwuLi8xQ5aJhn4uFXAka00OVr4qTzdPenL6CXRbL7DvGhqvXVhfozJ6m4y/4VqMRvGPe1EGqq2Hxk8Bn/oRnyexPZjjKZRrdKipnpbHiUOuKIbfXd0rVBj4xAlTKvF636Dlv7FauJowhdwWW4svy7410gTjFJuTy+tXeyh+s1RZE3FVrJpWPLrZSSVkL3/AF8KPa7bzVAH2s4M0ERbz9u/Kv+m4qDQe8UIytKF2AgbtKP/iyXqqyM1cwCdWCUnE1nMTTg6aVg/xyVWzibUuV+UA5Eky+mvfDTIFxxK8yY8PYuN/PG+IYyTQH5qlhOTQDJpoFyqDdoSYn3gUt6bPcaqoi3PpfSMg0v3znZF/wIrmzgJZxadMNqfHJNPy3Uzjm9eGCM09xsBGHOs3+lM3wiCAe2kY5NaExCP+aufCf5zZyxOPEWLQXwCtOR0rjaPV9rRlPCwPsfyhqZnFfET87vo2U0S89vrwBlwq/Ca/bLSu2g8luA2Vg9IwQNoXoM8lMR017bPhw/I7Sy091Cz/2m8NM8dAeYd5J3chqm4GjdIrTLpUih0EHIyhCssC30W2FvK4M1AqNQt4jaKqws4oWZ9NqMbqD7r5zqY++tt4Y6bXeYN7Bgpb0K9exH8cvD8y1 HPkgPeU1 nwWXyt9+XmRa5unTQRQpRS5+Ivk/tCpd/6CykCl1M3xJ4VrtQe9AhJwFb/ilfJGMgFG64yTTxFHx+yKCuXreQSfPAPF6p9yf28S9EingTtMHIR+PEWdTc9DMGUTGq3IkuG1+/YDr8Dqhl3FkEIzDEZd5MwnpONmLlsFoW5NKCNVwTUp2/24uOHtNdQkhs3HIX8J/B14djLNzKTI/EyXyAnRuyNLVxN/ZUcG1R7gnLHSIinY2SJaUwsiRKe9p877ozdEAEkuUA8OeKnXWyeGDLOgWlJAPE5XedDSqqVrPHuqghKt1yGiQ7NXXvSKt36fE19chmk1nj+mz5Y4w= 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 all vmstat related sysctls to its own file, removes useless extern variable declarations, and do some related clean-ups. To avoid compiler warnings when CONFIG_PROC_FS is not defined, add the macro definition CONFIG_PROC_FS ahead CONFIG_NUMA in vmstat.c. Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- v4: - const qualify struct ctl_table vmstat_table v3: - change the title - change sysctl_stat_interval to static type --- --- include/linux/vmstat.h | 11 ----------- kernel/sysctl.c | 28 --------------------------- mm/vmstat.c | 44 ++++++++++++++++++++++++++++++++++++++---- 3 files changed, 40 insertions(+), 43 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 9f3a04345b86..4751e3ecc467 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -10,15 +10,8 @@ #include #include -extern int sysctl_stat_interval; - #ifdef CONFIG_NUMA -#define ENABLE_NUMA_STAT 1 -#define DISABLE_NUMA_STAT 0 -extern int sysctl_vm_numa_stat; DECLARE_STATIC_KEY_TRUE(vm_numa_stat_key); -int sysctl_vm_numa_stat_handler(const struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos); #endif struct reclaim_stat { @@ -304,10 +297,6 @@ void quiet_vmstat(void); void cpu_vm_stats_fold(int cpu); void refresh_zone_stat_thresholds(void); -struct ctl_table; -int vmstat_refresh(const struct ctl_table *, int write, void *buffer, size_t *lenp, - loff_t *ppos); - void drain_zonestat(struct zone *zone, struct per_cpu_zonestat *); int calculate_pressure_threshold(struct zone *zone); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 7ae7a4136855..f1ab251fc2d0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -2071,17 +2070,6 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_TWO_HUNDRED, }, -#ifdef CONFIG_NUMA - { - .procname = "numa_stat", - .data = &sysctl_vm_numa_stat, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = sysctl_vm_numa_stat_handler, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_ONE, - }, -#endif { .procname = "drop_caches", .data = &sysctl_drop_caches, @@ -2147,22 +2135,6 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ZERO, }, #endif -#ifdef CONFIG_SMP - { - .procname = "stat_interval", - .data = &sysctl_stat_interval, - .maxlen = sizeof(sysctl_stat_interval), - .mode = 0644, - .proc_handler = proc_dointvec_jiffies, - }, - { - .procname = "stat_refresh", - .data = NULL, - .maxlen = 0, - .mode = 0600, - .proc_handler = vmstat_refresh, - }, -#endif #ifdef CONFIG_MMU { .procname = "mmap_min_addr", diff --git a/mm/vmstat.c b/mm/vmstat.c index 16bfe1c694dd..39704b5b17e0 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -31,8 +31,10 @@ #include "internal.h" +#ifdef CONFIG_PROC_FS #ifdef CONFIG_NUMA -int sysctl_vm_numa_stat = ENABLE_NUMA_STAT; +#define ENABLE_NUMA_STAT 1 +static int sysctl_vm_numa_stat = ENABLE_NUMA_STAT; /* zero numa counters within a zone */ static void zero_zone_numa_counters(struct zone *zone) @@ -74,7 +76,7 @@ static void invalid_numa_statistics(void) static DEFINE_MUTEX(vm_numa_stat_lock); -int sysctl_vm_numa_stat_handler(const struct ctl_table *table, int write, +static int sysctl_vm_numa_stat_handler(const struct ctl_table *table, int write, void *buffer, size_t *length, loff_t *ppos) { int ret, oldval; @@ -102,6 +104,7 @@ int sysctl_vm_numa_stat_handler(const struct ctl_table *table, int write, return ret; } #endif +#endif /* CONFIG_PROC_FS */ #ifdef CONFIG_VM_EVENT_COUNTERS DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}}; @@ -1938,7 +1941,7 @@ static const struct seq_operations vmstat_op = { #ifdef CONFIG_SMP static DEFINE_PER_CPU(struct delayed_work, vmstat_work); -int sysctl_stat_interval __read_mostly = HZ; +static int sysctl_stat_interval __read_mostly = HZ; static int vmstat_late_init_done; #ifdef CONFIG_PROC_FS @@ -1947,7 +1950,7 @@ static void refresh_vm_stats(struct work_struct *work) refresh_cpu_vm_stats(true); } -int vmstat_refresh(const struct ctl_table *table, int write, +static int vmstat_refresh(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { long val; @@ -2196,6 +2199,38 @@ static int __init vmstat_late_init(void) late_initcall(vmstat_late_init); #endif +#ifdef CONFIG_PROC_FS +static const struct ctl_table vmstat_table[] = { +#ifdef CONFIG_SMP + { + .procname = "stat_interval", + .data = &sysctl_stat_interval, + .maxlen = sizeof(sysctl_stat_interval), + .mode = 0644, + .proc_handler = proc_dointvec_jiffies, + }, + { + .procname = "stat_refresh", + .data = NULL, + .maxlen = 0, + .mode = 0600, + .proc_handler = vmstat_refresh, + }, +#endif +#ifdef CONFIG_NUMA + { + .procname = "numa_stat", + .data = &sysctl_vm_numa_stat, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = sysctl_vm_numa_stat_handler, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, + }, +#endif +}; +#endif + struct workqueue_struct *mm_percpu_wq; void __init init_mm_internals(void) @@ -2227,6 +2262,7 @@ void __init init_mm_internals(void) proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op); proc_create_seq("vmstat", 0444, NULL, &vmstat_op); proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op); + register_sysctl_init("vm", vmstat_table); #endif } From patchwork Sat Jan 11 07:07:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935833 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 47BD9E7719A for ; Sat, 11 Jan 2025 07:12:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA5086B0095; Sat, 11 Jan 2025 02:12:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A07496B0096; Sat, 11 Jan 2025 02:12:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CE9A6B0098; Sat, 11 Jan 2025 02:12:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 74ACA6B0095 for ; Sat, 11 Jan 2025 02:12:32 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E59C6141117 for ; Sat, 11 Jan 2025 07:12:31 +0000 (UTC) X-FDA: 82994302902.01.897EAB3 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf15.hostedemail.com (Postfix) with ESMTP id 76F50A000F for ; Sat, 11 Jan 2025 07:12:29 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579550; a=rsa-sha256; cv=none; b=oPqUfPbRNUvyguatXBOkZ19bOp/zrYA1xaCikkqbj3X1+LSh37oeBna6vbNf1eEapWJR1K cD8n91s6Woqr4oG+eigrTL7klpjTBiY5X+iwAkwIf58unQMm4aB/c2tdE0ZEDx0miqmYOv O5dCcWk8VK7z5MvF8OU+1yKpRbM+H04= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579550; 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=6UBGVNvTgbcESqxAWZqyLJAFRd+PZBsONVz8Tk+d2Lc=; b=Oh9rOZm0slNus4Igxt5N4NkG7hLt8OBnfH2YuHcXDVaACaDT4JvISR7IBRyIQa60Kv+Ovr r5jE3dfvmtRQ8QwFHKn/uMp25jOxIULcyTJTMVnMdYPb8xHH2wdxsXnpU0VMThXWk/bKu0 hRYSoFjJ3L6IUVtJlBgpsMfErBDUsDM= Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YVV4s40hhzbjqn; Sat, 11 Jan 2025 15:09:17 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 10BBC1401F3; Sat, 11 Jan 2025 15:12:24 +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; Sat, 11 Jan 2025 15:12:20 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 02/16] mm: filemap: move sysctl to mm/filemap.c Date: Sat, 11 Jan 2025 15:07:37 +0800 Message-ID: <20250111070751.2588654-3-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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: rspam04 X-Rspamd-Queue-Id: 76F50A000F X-Stat-Signature: kqk1rcreup8hbkcs5opdoz5hz1zs3m19 X-Rspam-User: X-HE-Tag: 1736579549-266211 X-HE-Meta: U2FsdGVkX18XfCE2ROTjELzCJRqOthPnZpuR9MyxqjYLF3ghoc3xgpCNXXQMuowEP+/bepbG+2Kf6HQbFlAcCzPfTG0w26GFxSz6LzDFhKpH0DIf3nP5j/puy6ofMKwuE11CLRjpbwDl8+GteIXufHYTOxNrB+4YwpRi7s4c77QyS0ieoBp98MkdvABJVCyK/u/o8ytNXUKtr/SWlkgA8LH5a2ZK25YryfIcTsYR9Xhc+MR5qLDuC+oEpPhhldN2DyV93PPBrHOIpDfUtH4+VU8Yw/NPJaVE8AaRXIpgHsu+mIcAz1D48h/s9dKw/pvRkmxZH9ljWU+XiJR5aeIYBBbPodmrprtlAOXCMhBpte7vE44EFK4BURO3+1z6Q6VSRZVtnFKlxAg5etHQRkoTnJfgTzcnAa8tJDA+YFD5k5ZeTNHN0SuevQt/3fW/BcoQIFIUssUGmxpytMu1cQVQd2UtvoDxTvV725Ogfz+DKrkaZ8CmHvWU08MK1Skv6vtnWsaZqFuzn/fB9qAkFtxovqBnZPPeS3l97chlUdam+SQKvxvD/ThXPusilYWmsIkWwpynIFGGxvFyL+lluW8rZItU75ODsfahYE0BavrnU/dRBK452KsDXi0l5Usa5WMIb+DvIPxmOhhvS524GBpMD7cF4utM8hJ7DUBqMNM1vL6fmBMHZENJ+kRqV/P0ARDTfWwJH6esAJ5W91mhHR26UCgXbzHJVnCSKR1CXsSiXmmbiw9G3tyqTrEnRCZ+RKvLRjeNCM6D8qLNx+lXaTXsmfu7G3LtV4wOf4IyZLsJYMiT9jQTPVBTQRKTjReqmHNCQjraVI+VSbRceWnOvMM3uLxpUDm0tlt64MoOe0XbjwS4btkRm0b8Y6HSBDsULLrQFmF+UxoFJkIBfIbO+7GuHbVJPGX8s0VDp+1b3k4xAE398l0Wy+vVF8uyKY7Oyrt15sGeCTmAqrCYbgqs9Be f5e1zdPE byNgm3+PBzjgasQQg/xCmqKi9zd4KJ4Pii168NyLiYOfUhAkdQJS6VV4RpgyHmE7P2gec9G7S3kA2CLWYqwkuZUXCeQEDdl4HhQtebrRwKJDGCmK6R+L4eUMAn7gpP/GDPK5DMs5RSxX/YlJIpPXYsYKpF+J5OB86hEPckVu+Xif9us4cCdtx7ELKpAs4JEYMEnMvZLTKN6L5Dr0MUlucjq3x6eOcE0W6ijcAl+x3wV4crvbHAPN1T3aHprZ1wZaqPHyDgQjyqWmz2OjCEfROF0lW+KSv5B6xjkTH+tkDGX0ihx3WkPMWIJj6c2BAnOpUr2pa 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 the filemap related sysctl to mm/filemap.c, and removes the redundant external variable declaration. Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- v4: - const qualify struct ctl_table filemap_sysctl_table v3: - change the title --- --- include/linux/mm.h | 2 -- kernel/sysctl.c | 8 -------- mm/filemap.c | 18 +++++++++++++++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 75c9b4f46897..b9a63a6c960f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -41,8 +41,6 @@ struct user_struct; struct pt_regs; struct folio_batch; -extern int sysctl_page_lock_unfairness; - void mm_core_init(void); void init_mm_internals(void); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index f1ab251fc2d0..23c8db80da5d 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2079,14 +2079,6 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ONE, .extra2 = SYSCTL_FOUR, }, - { - .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 9a1aad0c66b9..29c131b84294 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -1078,6 +1079,19 @@ static wait_queue_head_t *folio_waitqueue(struct folio *folio) return &folio_wait_table[hash_ptr(folio, PAGE_WAIT_TABLE_BITS)]; } +/* How many times do we accept lock stealing from under a waiter? */ +static int sysctl_page_lock_unfairness = 5; +static const struct ctl_table filemap_sysctl_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, + } +}; + void __init pagecache_init(void) { int i; @@ -1086,6 +1100,7 @@ void __init pagecache_init(void) init_waitqueue_head(&folio_wait_table[i]); page_writeback_init(); + register_sysctl_init("vm", filemap_sysctl_table); } /* @@ -1233,9 +1248,6 @@ static inline bool folio_trylock_flag(struct folio *folio, int bit_nr, return true; } -/* How many times do we accept lock stealing from under a waiter? */ -int sysctl_page_lock_unfairness = 5; - static inline int folio_wait_bit_common(struct folio *folio, int bit_nr, int state, enum behavior behavior) { From patchwork Sat Jan 11 07:07:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935834 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 6AB80E7719A for ; Sat, 11 Jan 2025 07:12:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01F196B0099; Sat, 11 Jan 2025 02:12:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F0FB36B009A; Sat, 11 Jan 2025 02:12:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFE806B009B; Sat, 11 Jan 2025 02:12:35 -0500 (EST) 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 BE99A6B0099 for ; Sat, 11 Jan 2025 02:12:35 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6D328C1104 for ; Sat, 11 Jan 2025 07:12:35 +0000 (UTC) X-FDA: 82994303070.14.A6DF468 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf10.hostedemail.com (Postfix) with ESMTP id 137DCC0003 for ; Sat, 11 Jan 2025 07:12:32 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.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=1736579553; 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=OsBPli+Wj7Y+O/vcSAGFSGTIy9nboiO7cAlq8sbiAz4=; b=0zEQFNrlL8n7SKffOq50JBjUgjz9NE9PXyUUh76sYx5TmDT1gfCuRPCIYFlTp2Lnq2A67I LUFg8dC+C2l4gcAz/GXTnFpjNtbcUeFDpIIOoPqKK/ovXn/UaoI8nDM6qPfIIqnj2VfFhH ZEx2+AW8cikaL5Q8qkmmwGGUekzGkOw= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; spf=pass (imf10.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=1736579553; a=rsa-sha256; cv=none; b=B8QbaiIy+32sQexv+0GelMPOezUlwpmpNr2ulIU/8ksNnLA+fbaND2e8EZKMeayVYigzd5 x0PvLIggblBs0wwoGpcPPfC2MNlI6+LBB612lOzEfR8Ayinbjs6ms8ztmabUARB7nUy2JN lFEUC2CPiaG6RZH+BT8VGoD0Hxw+pYM= Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YVV6Z3mXnzrSD8; Sat, 11 Jan 2025 15:10:46 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 7F8FB180218; Sat, 11 Jan 2025 15:12: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; Sat, 11 Jan 2025 15:12:23 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 03/16] mm: swap: move sysctl to mm/swap.c Date: Sat, 11 Jan 2025 15:07:38 +0800 Message-ID: <20250111070751.2588654-4-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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: rspam05 X-Stat-Signature: poo7m1rk18nfor635nbzgsx8rz39cka7 X-Rspamd-Queue-Id: 137DCC0003 X-Rspam-User: X-HE-Tag: 1736579552-151257 X-HE-Meta: U2FsdGVkX19QvpGsqJZ6HzaQ50UZcGJ11/rgf9JlfBCm5Zm5V/2FFsZYGkA4rV8XI6l5tPkRvYdhi17sL++tX6PdHIeCInQ6bGlyMwlTgjZn+XB6FMQiSOQ5ARgTQyBVkR+Rb5t5PkQYSw8JULt455Fmxslz7ccaH86QfMYtloq6Mo6czGC9+4f473UY2tUvwY+OT1BNrYQrTSvZFhnah9dAkfiolYb79OxMJo6zoOpbG93nWcayfYMK5Divo6h77WPXD5Q0KG8Kkk5zO1Lk2/AEYrFSA56SdC9mN+I3HywGscxikESouLEET9TiskJ9jHqndJTIfkTsYtOinvIlQaz4PUtydX9cSzkjyvIa9jhMl/kW1fTpaZKDw15e/sIwuYJxx3P8HUSU8dJyWY8eWkTNS8ZRhqhMHsxZQkkl8JQLuljLoJdwcawd/9hiXyQcmS76qvCcEw5ls1NVJQEr0KnDMEswdUuEa+CEcQTXRFs0oeBMqyDB+zxUopw3fgkhIoaYVxN/hrY5Fh3eXklZ9kCRhlsj3Eg72HKRW6K1NI8+Ou6rbl2pcMojMqUGv8YPzIpt8OQHsdD0LciEX242gtnIG9VBXVao6widohdcKuWUQ3X/6YWBPPRiFn5GfZSrH6dtxlfAsivtDsFkIdPboDHM8wV7eS4SlNlYBtOdpNO3zMH1tfAGOTJCFm/tuhX2goNguTbZW1cRBZbhWRl67B3RLIr3pU2KWvQ60lMSKWRFMBNffPUVE/ro3LZEwfr/cfBJ8eynchMznk/ulC48DfGobq0YwGvvbGXApbs5rlOMUfH0DdXsFGRjD0kfy/p7RA3mSQkvxdV56fpLP9piDJkJEXv9oOTLwy87Rk0i9Q7hNGlxUnmxd0xk2LF/n1W70lXjZsT5wMCMHWjD8LrBHY9D3UluuUhvhH9nwuSvRG/DD5Oo06ztqtdvLT6/0ctr0L867fuYY/sh3/ElYrH zLgos86f OFfMcazqSMYybBNhOXQriK4+TLHQGxk7aLfxAVXZiOVqgq7zb8orL9wLRNy+ypwfZHHBmpNy0zCw4TNvuJW2EFuXzlPk0XK+c+dqLzbmrqtSoOrfdEfrGgn7xiGWeIGd6oQerr+VPL0WGiXN0lXt6iE0SUkntWN40RO5ZYtUMxSAy6CjEQ4ozYY3Df0EO/nBRAUAFj2pmLICVvbsAX5rwMbrmBlEBQAlutCiORagKmdNaN7YrBQZayq81k7z/eq1n2qkwF3VXaVOaGejgt8D/tr+MEfMNdyyslgQPRhDDYwCkJTh+CHPlO78ekQ4EfqpfKe1OZ65Cvt43b8Q= 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 --- v4: - const qualify struct ctl_table swap_sysctl_table 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 b9a63a6c960f..fb00ee129f77 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -77,8 +77,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 23c8db80da5d..ab5d94f07e53 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -2044,15 +2043,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 fc8281ef4241..b81cce146eb2 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 { /* @@ -1076,6 +1076,18 @@ void folio_batch_remove_exceptionals(struct folio_batch *fbatch) fbatch->nr = j; } +static const 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 */ @@ -1092,4 +1104,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 */ From patchwork Sat Jan 11 07:07:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935835 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 BAF34E7719C for ; Sat, 11 Jan 2025 07:12:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 59C6C6B009A; Sat, 11 Jan 2025 02:12:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 525E06B009B; Sat, 11 Jan 2025 02:12:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A08A6B009C; Sat, 11 Jan 2025 02:12:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1AE2E6B009A for ; Sat, 11 Jan 2025 02:12:37 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CE4AE160A2E for ; Sat, 11 Jan 2025 07:12:36 +0000 (UTC) X-FDA: 82994303112.08.FE434FA Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf09.hostedemail.com (Postfix) with ESMTP id 518C9140006 for ; Sat, 11 Jan 2025 07:12:33 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.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=1736579555; 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=u+kpxXQ7n3Azx1RGE25K0gJ5xLgBOXqzBRbO/YM0rKQ=; b=PwVBTWsO9XJtSeiUfYvWBr+HuoxEjyOflCAuYFFX9i5DfDKnTg8FFr8tNDukvRGLnvbyft uY8OgTgtUCM1VWoCOro5FFLPO/ODkk0cvjKyqmsvKiBcvcK5hurBFGKbhtyoACG6ZECUPO lXG4DuAoi9+Onix7Kuh+jWhJFmBOu5o= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.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=1736579555; a=rsa-sha256; cv=none; b=aBeBYah2YNaVUwNb6b1atBZEff+k6ZpOsCIZbgCmVqHQkNxJQAebJC40IMCheo6QPBXfwH nvSIRSfI6F2i8drMmz7MeXggM2VWv1wcCaOHluO6tVqfWuQOpJdFbmugIZBupM2ozxrRcf g+ANROR1zJWeEVaVEDfCn2YzezBAnqU= Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4YVV516XRFz2DhnV; Sat, 11 Jan 2025 15:09:25 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id E72E41A0188; Sat, 11 Jan 2025 15:12: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; Sat, 11 Jan 2025 15:12:27 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 04/16] mm: vmscan: move vmscan sysctls to mm/vmscan.c Date: Sat, 11 Jan 2025 15:07:39 +0800 Message-ID: <20250111070751.2588654-5-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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: rspam06 X-Rspamd-Queue-Id: 518C9140006 X-Rspam-User: X-Stat-Signature: e7wmptjjgwtoeatocepy7bg7g6fizykj X-HE-Tag: 1736579553-736030 X-HE-Meta: U2FsdGVkX18i/MdkB0uzChcovicCW5/8vkZYm/00b6h3XpsSN1UkUo39PuslZrJ+yrgbY12hstfx1H4dSeb5/JQKYnyOWmfmTttgRJN67MVdUvhEUHMXXH6UTb54jEDHFN2DChodIfWWoYPM7HhC6GbsXSDfSVqDPkTpySCCR6urewHiS0olKxvvXB0GibBSRcV7hP65089Uu7AhlecyJbpI2HXJCle/QzyZO2NeoVFgT31unYhHDJn7kthiDIEiosEXD88lziTG1pbC20kHJLHo35wCefiOcbv868wnq/ulDBtB0qbhVS0BAqlkyAYhaHUwpCMYKAqeMNrhK45Xv1sgCIQkkjY2IqAC1PcXUmB4x3dZ+39o1Zx2s6gmD7wQWOOKU89/RwMRgek1kmhXTkMEAszPkxKU1TgGNHsBpUMqot2g2sT5PCbKSx9dZWtdGGLC3Mxq2r2SjmvSj7HXVbBtU3rN9gaq5xoMnmJHNYKjYUD53a+A0fzzc3o7lNtgi/MkL/OMx9MDGhfoGNMM1g0TnqqEmiZ158gXE4RlQFugrYUTm5/ALpHJsIREZnBa58JETg8OqJi55gZ09W4tVLxyiA2fNi7rQ/AcpLKNhX/dpFK3ArWz8qc8ixBqvN+ET1OBtXhlhwlyZOvPjHZsxcK79CgFuPg0cEyBWN/PPpqnAozcDMCNvx52te49XcypWVqsLznf/+ZAQ2hJGq7rGijXkf6W0MLaUkFgbdEY46ejJJO/CqGhsL+8rfPbLv9cdIeTQkVCWk/HZr3GgOtyw/JECyrtqNoxzJBEqEFaIyde5Okg2JRZFFPECMj5EqRF2EYQ2ZYQgYxfCCS6rJT6oy0dyB2iT/jljrzXvXm0PGBkkJrctFMLQ1OP0nzmUpfB5L4qJIf63rQ7oUgOR8GC+P23KEjD+PdI02ecVZgNm312uOGTR10xzBNRQcpRwXeUd7a7rslR3HifvfMJ2q7 BWmOMeVD ya+JR5Ww6+Y5VuTdpoUGqGsWtsAWyVfhEweN1XdtwfxyjsYRpu+4GqsfpcZ1AvVscbpZVv1XAmxwp+DsJJ7HV1F8E3dUnG0bJYPtnaL/mJGzU29R1Hin/zq82mkRemIQkpz4pnEyL4AWqVdOiokMDYuOAyQgZTsgBCBEFox0an0D0CbY= 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 mm/vmscan.c, 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 Reviewed-by: Kees Cook --- v4: - const qualify struct ctl_table vmscan_sysctl_table v3: - change the title --- --- 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 b13b72645db3..a98c757400fe 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -433,19 +433,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 ab5d94f07e53..cb6ca272fe9f 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2051,15 +2051,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, @@ -2107,16 +2098,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 109ef30fee11..cdbbe4c215c0 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1097,9 +1097,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) { @@ -1111,6 +1115,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 6d06bb40d5ad..f1183519bf41 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7404,6 +7404,28 @@ void __meminit kswapd_stop(int nid) pgdat_kswapd_unlock(pgdat); } +static const 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; @@ -7411,6 +7433,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; } From patchwork Sat Jan 11 07:07:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935836 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 CEF59E7719C for ; Sat, 11 Jan 2025 07:12:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 54FAD6B009C; Sat, 11 Jan 2025 02:12:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D6AD6B009E; Sat, 11 Jan 2025 02:12:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 350D86B009F; Sat, 11 Jan 2025 02:12:43 -0500 (EST) 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 1071D6B009C for ; Sat, 11 Jan 2025 02:12:43 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B6534160F20 for ; Sat, 11 Jan 2025 07:12:42 +0000 (UTC) X-FDA: 82994303364.07.7159197 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf05.hostedemail.com (Postfix) with ESMTP id 33CC4100007 for ; Sat, 11 Jan 2025 07:12:39 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 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=1736579560; a=rsa-sha256; cv=none; b=kJTDhZTBh+XAazebZcCJZ05k/PQgkVsqVStNSLeOWcqSqSBdtZ6sSdZtTqLBUUiNHUjTPF iTZrNi77b3UyVxjPjMwCEPzer/tgglcM5hM55ZnfiqiCJY7nkIdRki226DbhA0Qy1u/z/z KtwMA8HStS7Jp8TjyyifuiCQ5N8UVDU= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 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=1736579560; 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=Pbxxt4FgRldAJDBZQ6CMOcIINQ/lGGXQBdXcREMiDgE=; b=r+XjCk67v+VMynyMeqnABpOMxstxHPahz2pflFewDDKSSugK0DqxQMlSa4QH0zyHI91cjv Cc2fvsjO4AGwcku6GIoX6n0azHhD2Ca68h38xtoOZGJzPbbJRwAcUsFjceATEzFvTJkfFt Je8t3bXZEitsWX8/JYfq4JXvqFoCx/Q= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4YVV5G4mbpz11RmN; Sat, 11 Jan 2025 15:09:38 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 892DD180064; Sat, 11 Jan 2025 15:12:36 +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; Sat, 11 Jan 2025 15:12:30 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 05/16] mm: util: move sysctls to mm/util.c Date: Sat, 11 Jan 2025 15:07:40 +0800 Message-ID: <20250111070751.2588654-6-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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-Queue-Id: 33CC4100007 X-Stat-Signature: 7b45nghukikif6bs79qcmsjdbgac8hg7 X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1736579559-592331 X-HE-Meta: U2FsdGVkX1/JFqzwsnclXxeXGmUfqUB5aSihAgZrQUNdm6aiP6zz+JnqAgWi2/q+NX0xBnl6P95f7VAt1zxmRT/MkLZe29qzw7O5/TvJm0Zz3Z8Uv7+dXDskYcfc30Hqh0W1++TOVdoP/gsBPDjHv1RM2TdmjsyKwQG3XiQDajNf5gENvzr7O56+cVrrXOTVzpXXUsPYCx7n5S06C7YIcI3O+WjXKav88zeymATYaLze/zLhu7s3hyC7KCKfS/A8khDWjmCDGZbgRRsTKcXT232gg3VbgBkufKui/4Pim9IIn1HGTyaLjDtro6lF8a+vXLUjlw7CsfuQRKGeILrGigKtH60qf1CPdO26xH8+X/AEHDx00NUOZEXeVy8r4AAPKST29LpdCITgXKAfV6iMBlYaS+Nyv9LkdwQ/9BpPOzmRNCRTSzKzd6DweqV0Ie9WNjMLyljsnfUjZ08AotRJnqlVXBamBh7tDpKNxpjLoSpJc3+GvbYU3n902L+eXJNIIJT0XnuIStVYLkZ27naGoLS7d70SczbxV6r1Co+tLt51X9hq1oshb1TwRwmXiRzQg2u1qA+7ql7bHVyK+vxwkxOtLBhZpz0hrof4j21dIk5kTOG9aQpRl6AfnVFOVGTeOwHOlTOoYzTX48LqyNzspmffdsdjgZF5uiY4zYrNuNgVXlIzJBgvs2nz+Ay2hRxObYC069YacvRgKgN+KpoHlUlbuSzIEuemyuzAdrtOQga/o+OtUqf//GjNwjwZfj8Hk3s2uWSdgcOfa5NCV75NSVcZs95HvIiA4BYr2T/fPx4nW+ghRTjEQx13VAw46K77q9bkvI32WKrqwbbwk1EINLYsGIFjgVVFWQBS9m5Fwx4FVZVulzM0nelK3P7RFz3lfBZHlb8tju4kJMjbjlK7X7CXGg6+W3eQ+eZB9KsP7KK5dPPhX9jCuIeSEfV9Vwp/0sN5SosgmImmoKlr+Ws wBphJVda hKbc2Ca28KMwoFGXZUiJd3AUDWkGy5sO1yyT1EYkaBgvNbKRcfgjG6AW8WhRF73UUd+K/Y3/IZjKiNtNkOH24AqV+wT50vsDC3IGbVu8ahGzt5uVAJo7Gr9er5b93gRNHN5KYIHxp+KyFTD2NRZfl1JuccdG7OfGZZ0q1Ekrl2+53wnE= 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 all util related sysctls to mm/util.c, as part of the kernel/sysctl.c cleaning, also removes redundant external variable declarations and function declarations. Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- v4: - const qualify struct ctl_table util_sysctl_table v3: - change the title --- --- include/linux/mm.h | 11 -------- include/linux/mman.h | 2 -- kernel/sysctl.c | 37 ------------------------ mm/util.c | 67 ++++++++++++++++++++++++++++++++++++++------ 4 files changed, 59 insertions(+), 58 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index fb00ee129f77..5776bc524087 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -206,17 +206,6 @@ extern int sysctl_max_map_count; extern unsigned long sysctl_user_reserve_kbytes; extern unsigned long sysctl_admin_reserve_kbytes; -extern int sysctl_overcommit_memory; -extern int sysctl_overcommit_ratio; -extern unsigned long sysctl_overcommit_kbytes; - -int overcommit_ratio_handler(const struct ctl_table *, int, void *, size_t *, - loff_t *); -int overcommit_kbytes_handler(const struct ctl_table *, int, void *, size_t *, - loff_t *); -int overcommit_policy_handler(const struct ctl_table *, int, void *, size_t *, - loff_t *); - #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) #define folio_page_idx(folio, p) (page_to_pfn(p) - folio_pfn(folio)) diff --git a/include/linux/mman.h b/include/linux/mman.h index a842783ffa62..bce214fece16 100644 --- a/include/linux/mman.h +++ b/include/linux/mman.h @@ -59,8 +59,6 @@ | MAP_HUGE_1GB) extern int sysctl_overcommit_memory; -extern int sysctl_overcommit_ratio; -extern unsigned long sysctl_overcommit_kbytes; extern struct percpu_counter vm_committed_as; #ifdef CONFIG_SMP diff --git a/kernel/sysctl.c b/kernel/sysctl.c index cb6ca272fe9f..aea3482106e0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2020,29 +2020,6 @@ static struct ctl_table kern_table[] = { }; static struct ctl_table vm_table[] = { - { - .procname = "overcommit_memory", - .data = &sysctl_overcommit_memory, - .maxlen = sizeof(sysctl_overcommit_memory), - .mode = 0644, - .proc_handler = overcommit_policy_handler, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_TWO, - }, - { - .procname = "overcommit_ratio", - .data = &sysctl_overcommit_ratio, - .maxlen = sizeof(sysctl_overcommit_ratio), - .mode = 0644, - .proc_handler = overcommit_ratio_handler, - }, - { - .procname = "overcommit_kbytes", - .data = &sysctl_overcommit_kbytes, - .maxlen = sizeof(sysctl_overcommit_kbytes), - .mode = 0644, - .proc_handler = overcommit_kbytes_handler, - }, { .procname = "dirtytime_expire_seconds", .data = &dirtytime_expire_interval, @@ -2123,20 +2100,6 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ZERO, }, #endif - { - .procname = "user_reserve_kbytes", - .data = &sysctl_user_reserve_kbytes, - .maxlen = sizeof(sysctl_user_reserve_kbytes), - .mode = 0644, - .proc_handler = proc_doulongvec_minmax, - }, - { - .procname = "admin_reserve_kbytes", - .data = &sysctl_admin_reserve_kbytes, - .maxlen = sizeof(sysctl_admin_reserve_kbytes), - .mode = 0644, - .proc_handler = proc_doulongvec_minmax, - }, #ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS { .procname = "mmap_rnd_bits", diff --git a/mm/util.c b/mm/util.c index b6b9684a1438..b3480f358d11 100644 --- a/mm/util.c +++ b/mm/util.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -906,14 +907,16 @@ int folio_mc_copy(struct folio *dst, struct folio *src) EXPORT_SYMBOL(folio_mc_copy); int sysctl_overcommit_memory __read_mostly = OVERCOMMIT_GUESS; -int sysctl_overcommit_ratio __read_mostly = 50; -unsigned long sysctl_overcommit_kbytes __read_mostly; +static int sysctl_overcommit_ratio __read_mostly = 50; +static unsigned long sysctl_overcommit_kbytes __read_mostly; int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; unsigned long sysctl_user_reserve_kbytes __read_mostly = 1UL << 17; /* 128MB */ unsigned long sysctl_admin_reserve_kbytes __read_mostly = 1UL << 13; /* 8MB */ -int overcommit_ratio_handler(const struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +#ifdef CONFIG_SYSCTL + +static int overcommit_ratio_handler(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { int ret; @@ -928,8 +931,8 @@ static void sync_overcommit_as(struct work_struct *dummy) percpu_counter_sync(&vm_committed_as); } -int overcommit_policy_handler(const struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +static int overcommit_policy_handler(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table t; int new_policy = -1; @@ -964,8 +967,8 @@ int overcommit_policy_handler(const struct ctl_table *table, int write, void *bu return ret; } -int overcommit_kbytes_handler(const struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +static int overcommit_kbytes_handler(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { int ret; @@ -975,6 +978,54 @@ int overcommit_kbytes_handler(const struct ctl_table *table, int write, void *bu return ret; } +static const struct ctl_table util_sysctl_table[] = { + { + .procname = "overcommit_memory", + .data = &sysctl_overcommit_memory, + .maxlen = sizeof(sysctl_overcommit_memory), + .mode = 0644, + .proc_handler = overcommit_policy_handler, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_TWO, + }, + { + .procname = "overcommit_ratio", + .data = &sysctl_overcommit_ratio, + .maxlen = sizeof(sysctl_overcommit_ratio), + .mode = 0644, + .proc_handler = overcommit_ratio_handler, + }, + { + .procname = "overcommit_kbytes", + .data = &sysctl_overcommit_kbytes, + .maxlen = sizeof(sysctl_overcommit_kbytes), + .mode = 0644, + .proc_handler = overcommit_kbytes_handler, + }, + { + .procname = "user_reserve_kbytes", + .data = &sysctl_user_reserve_kbytes, + .maxlen = sizeof(sysctl_user_reserve_kbytes), + .mode = 0644, + .proc_handler = proc_doulongvec_minmax, + }, + { + .procname = "admin_reserve_kbytes", + .data = &sysctl_admin_reserve_kbytes, + .maxlen = sizeof(sysctl_admin_reserve_kbytes), + .mode = 0644, + .proc_handler = proc_doulongvec_minmax, + }, +}; + +static int __init init_vm_util_sysctls(void) +{ + register_sysctl_init("vm", util_sysctl_table); + return 0; +} +subsys_initcall(init_vm_util_sysctls); +#endif /* CONFIG_SYSCTL */ + /* * Committed memory limit enforced when OVERCOMMIT_NEVER policy is used */ From patchwork Sat Jan 11 07:07:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935837 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 D30E4E7719C for ; Sat, 11 Jan 2025 07:12:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D62C6B00A0; Sat, 11 Jan 2025 02:12:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6869B6B00A2; Sat, 11 Jan 2025 02:12:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48AA96B00A1; Sat, 11 Jan 2025 02:12:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 256116B009F for ; Sat, 11 Jan 2025 02:12:46 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D4F5CAE383 for ; Sat, 11 Jan 2025 07:12:45 +0000 (UTC) X-FDA: 82994303490.30.08320DD Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf25.hostedemail.com (Postfix) with ESMTP id 6A634A0005 for ; Sat, 11 Jan 2025 07:12:43 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579564; 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=8Ga+OQZ44mla62P4etydcq/fwz+iOpWaKbgGbyuFD9w=; b=RNMvsc/7YXkRC0rFIY0trdVz0otgZ0JXXNP+xg8YKll6EurpYJIqQfXpbzRuMJCBLSGPEi TClb8GTfjuWT4Y00zHafwTrcPRNdX11qXTYjV8jXDOzSm8oy7p6akKX2gimVSiF17pEIU4 Sp0b7clgO+TVwwR5EGO//49jcywgD7I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579564; a=rsa-sha256; cv=none; b=CtvzkwmJS6xLCDX8Fl0X73z5S6tS9VC6PVfF5R8+aJgSO/epg5FRibevBb0B8nwuGIXwoS sRMAGwT66XcCbvwJDK9fAVDwpfdPACucxce9SbRdEJKNcvd1vrO9TYpg+AFssWBCI+HmT8 kXDF6DdJJp0orEPRQ+soiUNCNdMgDVY= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4YVV4Q1yR4z11Nrw; Sat, 11 Jan 2025 15:08:54 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 03F68180064; Sat, 11 Jan 2025 15:12: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; Sat, 11 Jan 2025 15:12:36 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 06/16] mm: mmap: move sysctl to mm/mmap.c Date: Sat, 11 Jan 2025 15:07:41 +0800 Message-ID: <20250111070751.2588654-7-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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-Stat-Signature: rrdizp1788q4ucgcb5toc76azmqkg73b X-Rspamd-Queue-Id: 6A634A0005 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736579563-710527 X-HE-Meta: U2FsdGVkX19iYapar/HctM7SBjzBjIMczLN0ASTvaN0aC2LyM6whCOj76ripXoABMbHZ/8sOn31xj4qxE06fTDNbNoTOcf/XThJMcE3uNSFML77AiulHoPGZBVS372cHrVSiBzeSJwTyo4cqGoUNCiLgXWoNvlTTYfUERL2jponVEdp3UHzTtoyHs0HVK1UgjpM9G0yvbTGK0lp1l9Flg3MSKs9NBZnJ/x0jMyU002ocQ6bwbBDFVB38p9UhbXq7FZwYijvCg6lk7jNyqsis8ZkrxHoYofjg8u71Gg9XrJtg7ofbfrcXhHVp86aKpNboGfUv8rrzmPgYVFGMF6oOzrcpvVcIfHXtvGS8qIARynF3YykwPCXIYDjaCP4780+XUUEQ31aiEC22P/ZnZE/p5y19OtynIyEUkSfEjnLH9tuABiXv2FEnb8PuyLGNz4/OZKi5Lbqm/rkAYLPRlCBVktWkGlf6hCjeeIfSKar+l+0siVI4zjJG+pf0QX6jBh7UMFmqvEtcZN0hfRycQgOL/hmwu6vuz68mZgkul3b7rDRP0gVT6Ypun0BhqAjfXorJkQ622qGS7VIfHauVWbZQ2Dt0YH406tM9jx+mmjzIScjZL+5JQ++UcPGF+S1C+z0of8UQUnnctC0XFFjTkG0zPw2LGrQeF4wsRt4dxfTt6FYVgTZ77aCMI8MYY4cVY2f/8uz/VaqeAa0Cfzt/UJ+JLtajmREr2DVogGcUPs+56h3T9D3tNLqXHuvh93a4AI4m/u9qlxHp763kWNyBeMbth5z3JoWwQ7vF62Ve2At5/V76eICyMcJu0BQwy7EiL3Tu3WvD3RB6DU6oJQgI4KjcWyZg01pBET++2DQnJDoGVeJX5RfHAs3XtPBEBug0t+tWLIGm28tGHB2OmVeaMcscg94207poP3TF4VQ+C4ksT651vzDeP0FoqqWtwBBHdU3/v2Yy9oU6BMjQ5NLCS+7 giTpxWAe lK7WvnDHTPRyNABUTNJKmSjGVcemE3JKlrFrRf5n6RMf0YoYwhI7EwujgeB+NqLh1qr4SkPTbNHNUBejKW6uljRobTUcSkV1IOGxpy5GdYwY+Nnvlyli0g7MHsdUtaCUzWusHTAsGU25ace2P0u/2jJJ83qxeLRhjp0L+nfFgu69AhFQevO433eereJzReGdkgCU8 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 all mmap related sysctls to mm/mmap.c, as part of the kernel/sysctl.c cleaning, also move the variable declaration from kernel/sysctl.c into mm/mmap.c. Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook Reviewed-by: Lorenzo Stoakes --- v5: - add Reviewed-by: Lorenzo Stoakes v4: - const qualify struct ctl_table mmap_table v3: - change the title v2: - fix sysctl_max_map_count undeclared issue in mm/nommu.c --- --- kernel/sysctl.c | 50 +-------------------------------------------- mm/mmap.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index aea3482106e0..9c245898f535 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -127,12 +127,6 @@ enum sysctl_writes_mode { static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT; #endif /* CONFIG_PROC_SYSCTL */ - -#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \ - defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT) -int sysctl_legacy_va_layout; -#endif - #endif /* CONFIG_SYSCTL */ /* @@ -2037,16 +2031,7 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ONE, .extra2 = SYSCTL_FOUR, }, -#ifdef CONFIG_MMU - { - .procname = "max_map_count", - .data = &sysctl_max_map_count, - .maxlen = sizeof(sysctl_max_map_count), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - }, -#else +#ifndef CONFIG_MMU { .procname = "nr_trim_pages", .data = &sysctl_nr_trim_pages, @@ -2064,17 +2049,6 @@ static struct ctl_table vm_table[] = { .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, }, -#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \ - defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT) - { - .procname = "legacy_va_layout", - .data = &sysctl_legacy_va_layout, - .maxlen = sizeof(sysctl_legacy_va_layout), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - }, -#endif #ifdef CONFIG_MMU { .procname = "mmap_min_addr", @@ -2100,28 +2074,6 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ZERO, }, #endif -#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS - { - .procname = "mmap_rnd_bits", - .data = &mmap_rnd_bits, - .maxlen = sizeof(mmap_rnd_bits), - .mode = 0600, - .proc_handler = proc_dointvec_minmax, - .extra1 = (void *)&mmap_rnd_bits_min, - .extra2 = (void *)&mmap_rnd_bits_max, - }, -#endif -#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS - { - .procname = "mmap_rnd_compat_bits", - .data = &mmap_rnd_compat_bits, - .maxlen = sizeof(mmap_rnd_compat_bits), - .mode = 0600, - .proc_handler = proc_dointvec_minmax, - .extra1 = (void *)&mmap_rnd_compat_bits_min, - .extra2 = (void *)&mmap_rnd_compat_bits_max, - }, -#endif }; int __init sysctl_init_bases(void) diff --git a/mm/mmap.c b/mm/mmap.c index 7aa36216ecc0..9b9d7ded839e 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1544,6 +1544,57 @@ struct vm_area_struct *_install_special_mapping( &special_mapping_vmops); } +#ifdef CONFIG_SYSCTL +#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \ + defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT) +int sysctl_legacy_va_layout; +#endif + +static const struct ctl_table mmap_table[] = { + { + .procname = "max_map_count", + .data = &sysctl_max_map_count, + .maxlen = sizeof(sysctl_max_map_count), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + }, +#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \ + defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT) + { + .procname = "legacy_va_layout", + .data = &sysctl_legacy_va_layout, + .maxlen = sizeof(sysctl_legacy_va_layout), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + }, +#endif +#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS + { + .procname = "mmap_rnd_bits", + .data = &mmap_rnd_bits, + .maxlen = sizeof(mmap_rnd_bits), + .mode = 0600, + .proc_handler = proc_dointvec_minmax, + .extra1 = (void *)&mmap_rnd_bits_min, + .extra2 = (void *)&mmap_rnd_bits_max, + }, +#endif +#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS + { + .procname = "mmap_rnd_compat_bits", + .data = &mmap_rnd_compat_bits, + .maxlen = sizeof(mmap_rnd_compat_bits), + .mode = 0600, + .proc_handler = proc_dointvec_minmax, + .extra1 = (void *)&mmap_rnd_compat_bits_min, + .extra2 = (void *)&mmap_rnd_compat_bits_max, + }, +#endif +}; +#endif /* CONFIG_SYSCTL */ + /* * initialise the percpu counter for VM */ @@ -1553,6 +1604,9 @@ void __init mmap_init(void) ret = percpu_counter_init(&vm_committed_as, 0, GFP_KERNEL); VM_BUG_ON(ret); +#ifdef CONFIG_SYSCTL + register_sysctl_init("vm", mmap_table); +#endif } /* From patchwork Sat Jan 11 07:07:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935838 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 8CE48E7719C for ; Sat, 11 Jan 2025 07:12:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2414F6B00A3; Sat, 11 Jan 2025 02:12:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CA316B00A6; Sat, 11 Jan 2025 02:12:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01CCE6B00A9; Sat, 11 Jan 2025 02:12:49 -0500 (EST) 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 D39E26B00A3 for ; Sat, 11 Jan 2025 02:12:49 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 56B1844278 for ; Sat, 11 Jan 2025 07:12:49 +0000 (UTC) X-FDA: 82994303658.18.E312B6E Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf11.hostedemail.com (Postfix) with ESMTP id E423940003 for ; Sat, 11 Jan 2025 07:12:46 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579567; a=rsa-sha256; cv=none; b=ThhmyBDlCnY9x+1Pu5MonDRD4l6bO5ZVVJaCYKLaMmqLoBywXGs8jp/BhxJb34C4Rr05Tj lPfrR/wNVfqabVRh+n4Ryd+iPNz4lGq5Bp++TefrGXJqNWhHLKqKFn0BaJoTu45rpCs1N6 QzLM1FcdFUtYr8iFCKLKXLtubBGIzko= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579567; 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=JmVbJ1u7I/fiM/mZTKbXVhm296hUyc9nVwr6w+TBxSU=; b=lksqqpUPzA0npWLt3gWf0LkugVgXNINHP1qqySPwUxaFSq0AfUkqcPHYFUCCjgEJSPlt8o e+koLD2laLZh2c4FbIsFelgPPMKy9vY5lTotISRV4B1wJZTA+I3uXQOOGqFZ53Gt/wHVhj eMm74DG4epqeACJ/LlYlf7wZpHxOyow= Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4YVV692Jpyz22ktr; Sat, 11 Jan 2025 15:10:25 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 6C5F81402DE; Sat, 11 Jan 2025 15:12:43 +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; Sat, 11 Jan 2025 15:12:39 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 07/16] security: min_addr: move sysctl to security/min_addr.c Date: Sat, 11 Jan 2025 15:07:42 +0800 Message-ID: <20250111070751.2588654-8-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: E423940003 X-Stat-Signature: w1kzjq6q136dmpks8xwndrumzcnag515 X-HE-Tag: 1736579566-195171 X-HE-Meta: U2FsdGVkX18MvVBazTYJiOD9N875hWQIOyRy3+Tv4lImQpKqFjAkmU/aJkEOajLLxXAMWCTTNFBkN9C94Ug293sHSV9u9qBVsemdJlTeSlzwCT42zv8a+nZpCK1rPzxv6Zur9fUX+7YjJ16I/tmFGI1I9WteqRuEuGsMPxpQtsYbe04LHNlO9T+2/NsgyJqbLMjRjLyGuB/x5W9T7nmLckFfsjs3SjEx5LyIp7wCjcAQaYxrsOxnaYqlpsTICV4YzYysE4yclnFNWeGtkw/qPslI1ioGZI35ToCvSDjzRsGpYGv4N1JH3tgFj3ONz9ncHHo8fw2YZiqQWcnTtPguwpJapWWlvS4gb7cDKT8MYFkOEk1XyRzJa1/0LNaR61qO2U3+fCSIDMnV8lfeaR/uFhVZSNznDfDGqZcb9sOssmVFZkDJT+XtpVNXCu7OBqBT3Rzjq7RCC4YzOx45Skx0g/uj+ewOiHv0oEv59bB5q7tYTw+uFwkm5dWOJBN4RStahe6nNeuwjKmMiKxll37ay3XbjtfovCQpUBK0H9SeA5Mpz+o24N+qdRZl7Kk+shYOm4SwU/jsKBSV2GsIXZ12h7hKMNhquMIj8uXCo/cArIY8tg7xKzhc/FGrnBmT86oLBVnZwbpp6ZtgJ33HdBGcjfZns/ZDSj+i59pNMwSEzd5EcvqOjzciknogOV6bav2/Y7iSuNZgLq6cYTn97kZwQKFgQfMe503bRzHLw9cVPUFa8grE/ZRHEEacv1iawVd7xDhO+HRA4GBV2Gr23gBP/rFhJrEVVeihXSRCTITnm6UQXEfDjhBPjEB+LL/1btgEXw1KJewBV/OD0x0FoVJBox+BeX134zcyacHOyQL2wdzgj4GjqWtGYEMUFqBRF6/5re4pNjw72br6nNtmoEwZkB5a8X9qKhYAjuEwQ8/86BWsuAXDEOsGAfEMaDWaPeAkxVe7wNBZ4s12G51M1Wn HXXN9seJ 0jRJ1pdStyAJP0zpUb4RaX/8gzxb8Ga76Q8tOyqAt5HQy+CW5H6OPipIjxhVDXCP8XrsvqAMJtZZAF8W5hJn/CEEjMMz96t6/g019OJmHJQ7y337VMwKipLW/yZQzy/R/bIiaaS2nxHWdz/5T0BJ+d4CWEYNCxvAYGov5lrVEfDUkQDau80cXZLrRvulE4YzR8OWHN9BJJOQB4ygWpw4rMplmjdLb/Oy5Zj9ytwAGtJj9z54HkdgK/tWjcOHGshUcTW7FXTZqD7KN47mJrKmj3Dg7oy0cttDgWOF2GfLQPL4seN+WLViP+mNY0mJQRYh0AfOp+m7Iifxi8IAyV2riTDu2zWIBrkdeI7FeuNvhtEs6zgo= 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 dac_mmap_min_addr belongs to min_addr.c, move it to min_addr.c from /kernel/sysctl.c. In the previous Linux kernel boot process, sysctl_init_bases needs to be executed before init_mmap_min_addr, So, register_sysctl_init should be executed before update_mmap_min_addr in init_mmap_min_addr. And according to the compilation condition in security/Makefile: obj-$(CONFIG_MMU) += min_addr.o if CONFIG_MMU is not defined, min_addr.c would not be included in the compilation process. So, drop the CONFIG_MMU check. Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook Acked-by: Paul Moore --- v4: - const qualify struct ctl_table min_addr_sysctl_table v3: - change the title v2: - update the changelog to explain why drop CONFIG_MMU check. --- --- kernel/sysctl.c | 9 --------- security/min_addr.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 9c245898f535..62a58e417c40 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2049,15 +2049,6 @@ static struct ctl_table vm_table[] = { .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, }, -#ifdef CONFIG_MMU - { - .procname = "mmap_min_addr", - .data = &dac_mmap_min_addr, - .maxlen = sizeof(unsigned long), - .mode = 0644, - .proc_handler = mmap_min_addr_handler, - }, -#endif #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) { diff --git a/security/min_addr.c b/security/min_addr.c index 0ce267c041ab..df1bc643d886 100644 --- a/security/min_addr.c +++ b/security/min_addr.c @@ -44,8 +44,19 @@ int mmap_min_addr_handler(const struct ctl_table *table, int write, return ret; } +static const struct ctl_table min_addr_sysctl_table[] = { + { + .procname = "mmap_min_addr", + .data = &dac_mmap_min_addr, + .maxlen = sizeof(unsigned long), + .mode = 0644, + .proc_handler = mmap_min_addr_handler, + }, +}; + static int __init init_mmap_min_addr(void) { + register_sysctl_init("vm", min_addr_sysctl_table); update_mmap_min_addr(); return 0; From patchwork Sat Jan 11 07:07:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935839 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 AD806E7719C for ; Sat, 11 Jan 2025 07:12:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3EE4A6B00A6; Sat, 11 Jan 2025 02:12:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 378C36B00A9; Sat, 11 Jan 2025 02:12:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F1E76B00AC; Sat, 11 Jan 2025 02:12:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id EDA0E6B00A6 for ; Sat, 11 Jan 2025 02:12:52 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9DB9AAEE2E for ; Sat, 11 Jan 2025 07:12:52 +0000 (UTC) X-FDA: 82994303784.23.0E13A53 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf05.hostedemail.com (Postfix) with ESMTP id 44609100007 for ; Sat, 11 Jan 2025 07:12:49 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579571; a=rsa-sha256; cv=none; b=YZ8JT8x0l1IcMdikPIj1GqFH3TBwYBPHG4O/qEdggPQNjbyNmP6YA5jz/GZfPtmAOH4xMG 9s5btUPhqvO8jQarSN88MXEyoi+h4tsZsRYG3/gVoAKUeddo8CMMCHDYGjpx3b3lzaAD0N LkMtCC/Pa+bsJ39EE2mR6hk6ZnJW7WM= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579571; 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=9h7L3kt7UCCDfQqZONztIqoeNRwNjA8A4qLkL1IULWw=; b=UxgBDhnoXHsos7WOCIrMSYPKYNQ9js6R2PVtfL+zj5TQARr7WiOwrnxEHzOQC17dcR8/Jr cDL1VZzpRcXrZ9YVm1873DPwfgDsJX7VJLASmbmkliQuJ+nw60GFtDiw4PHiOtc63yKa3q 2RZS/BdWt5TkEhBqbAxWnb91cXGE6ic= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4YVV5L0Rz1z1ky3H; Sat, 11 Jan 2025 15:09:42 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id DC77C1402DB; Sat, 11 Jan 2025 15:12:46 +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; Sat, 11 Jan 2025 15:12:43 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 08/16] mm: nommu: move sysctl to mm/nommu.c Date: Sat, 11 Jan 2025 15:07:43 +0800 Message-ID: <20250111070751.2588654-9-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 44609100007 X-Stat-Signature: xwek9oz4749xyqjjd4tcfxuc9otpunhb X-HE-Tag: 1736579569-474715 X-HE-Meta: U2FsdGVkX1/853lRxzmFyE8PFNY0ojZvOM0AOcDwp/QIQPzGsCErIxAxJ0cbUgDhPIXZcC4btwr2zaq530esPTQO/uE/2LeJpzhNZkGbVg0Rz9Ob77msnCuLtsF0YAyQEvzIguDgEZjuDxgc5LrOZTcBBcT6Kcru2MsIlwRqJNt0XGwnp6UwY9aVjIbbav7XczlKYifXjsuhLCGlVlOloxBaX5YFUaxVfyzpHDB42GX9bLwpBNA0nzPZWhGnopm/Id6Y4Ui+EhAeKMmiyuTPdjTwq76tyF/clGlYZcT0ytOmq4QbgShUoGwy0rudiJWGpIULYsKVi1qLCtwrEkNUDfGlrZ3xJyFfuIsIBIRf/qXrFN0SPLWHBXstnSwjPvPD7ODgmcPITS3vlELDdX6qzmByaqGeQ1xsA0d1u8iBU/7JzkwThNqs+KKy5RfBAOMQLmucKzAu7bK0H6zk+HUv9TjghyPdB9xeDeN3LIsV1hurdCxSZr9WY2A5lkIRvSTUcgEkvqEuaSjw/iiKt1IQt8HMULckLdrR5JTgnJBcX+B18YbZxHsyQwyOY9Yj5z6z96ijyWZGZs1Q0QagWv6IYRdUjQvOB84PgV0/5983BdfaxWSY9LHX7xVSO8Zha2AXLxApqJ263SxTqSz3ApBkucZ7xqqJ8K30G83pKsMmmDfF9uwrYb4oDMLmA+THJsDxxOd9bFHemPYt5wyf0zI+NcGGXOTW411eJfDbwk7ImdpkUwd+hVQW8T+/3CGap0Zxd5JLR93fniLRAmJgvBQcG1vfJW5qJczrFjZWaeihnLjjxi56Obimuy7SESdeSZZqvta79Aqp9Jr+3NYnvhzFj3VY+0rUj4YoOpvAi5uT5GIfwwxuNSGbbm+tG+YAdd/48jIMb2Au5MVcUulzgFMTAw1Ks2AWfj44vfStIgQ0bBURusj9DHHOvf2TlJ3lgCoUmjeP/G87Px2Ouw8+FEc 5t33wHHt 203HLqVkcQBCxKXvTkLeyzcq+4d5FMtdjfcGEYKRMuSoRoHLwIbMJVPmfGbMKUBq1HpDQ7cs8ueJsQGLVZ7M9vwAyiiVXlelo1yx09WBU5ip7VEHkXmVnWBHEwRJjtjSIIAZ5LADPe2yxDIf7/2LiJk5SskIaW8p10qK+e765hQyT9UA= 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 sysctl_nr_trim_pages belongs to nommu.c, move it to mm/nommu.c from /kernel/sysctl.c. And remove the useless extern variable declaration from include/linux/mm.h Signed-off-by: Kaixiong Yu Reviewed-by: Lorenzo Stoakes --- v5: - add Reviewed-by: Lorenzo Stoakes v4: - const qualify struct ctl_table nommu_table v3: - change the title v2: - fix the build error: expected ';' after top level declarator - fix the build error: call to undeclared function 'register_syscall_init', use 'register_sysctl_init' to replace it. --- --- include/linux/mm.h | 2 -- kernel/sysctl.c | 10 ---------- mm/nommu.c | 15 ++++++++++++++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 5776bc524087..98654abef3b8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4150,8 +4150,6 @@ unsigned long wp_shared_mapping_range(struct address_space *mapping, pgoff_t first_index, pgoff_t nr); #endif -extern int sysctl_nr_trim_pages; - #ifdef CONFIG_ANON_VMA_NAME int madvise_set_anon_name(struct mm_struct *mm, unsigned long start, unsigned long len_in, diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 62a58e417c40..97f9abffff0f 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2031,16 +2031,6 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ONE, .extra2 = SYSCTL_FOUR, }, -#ifndef CONFIG_MMU - { - .procname = "nr_trim_pages", - .data = &sysctl_nr_trim_pages, - .maxlen = sizeof(sysctl_nr_trim_pages), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - }, -#endif { .procname = "vfs_cache_pressure", .data = &sysctl_vfs_cache_pressure, diff --git a/mm/nommu.c b/mm/nommu.c index baa79abdaf03..3c32f8b1eb54 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -48,7 +48,6 @@ struct page *mem_map; unsigned long max_mapnr; EXPORT_SYMBOL(max_mapnr); unsigned long highest_memmap_pfn; -int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS; int heap_stack_gap = 0; atomic_long_t mmap_pages_allocated; @@ -392,6 +391,19 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) return mm->brk = brk; } +static int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS; + +static const struct ctl_table nommu_table[] = { + { + .procname = "nr_trim_pages", + .data = &sysctl_nr_trim_pages, + .maxlen = sizeof(sysctl_nr_trim_pages), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + }, +}; + /* * initialise the percpu counter for VM and region record slabs */ @@ -402,6 +414,7 @@ void __init mmap_init(void) ret = percpu_counter_init(&vm_committed_as, 0, GFP_KERNEL); VM_BUG_ON(ret); vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC|SLAB_ACCOUNT); + register_sysctl_init("vm", nommu_table); } /* From patchwork Sat Jan 11 07:07:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935840 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 F165EE7719A for ; Sat, 11 Jan 2025 07:12:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8ABF76B00AC; Sat, 11 Jan 2025 02:12:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 85B4D6B00AD; Sat, 11 Jan 2025 02:12:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AEA06B00AE; Sat, 11 Jan 2025 02:12:56 -0500 (EST) 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 4190C6B00AC for ; Sat, 11 Jan 2025 02:12:56 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DB9AA1A0470 for ; Sat, 11 Jan 2025 07:12:55 +0000 (UTC) X-FDA: 82994303910.09.B560B0F Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf15.hostedemail.com (Postfix) with ESMTP id 6F8A9A000E for ; Sat, 11 Jan 2025 07:12:53 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579574; 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=Giw4aSA7nLP9q76arckZL69EH5cSA1K/X7FELVtRGE8=; b=HGioNgTRYjK8C91dpiIXceWZcSRDFEHQFR/3LewOKyCvoQgfeycO8FXPQzyEcLm1B1/MPd proSINTEAt92H5ATIwzr0HqRt+b70ti1PSxzBpeV/yHpO6eq/tAGsy/Uz/76PTo21Aw1Ic LjRLuVTLbDVzo4GQcwAEOYH4SmFAUjc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579574; a=rsa-sha256; cv=none; b=0BWDdXWCb6dVwoOZHb81byFmPX8G7yCtwbiOFTinxy2GBrIDFTHedi3NmNGyIEXwDl+gX/ K7/TiPuyKpo41YJeDKuGhxNIg/gHrYguabPV93dKPK9/wi5wXMS6arKpDKi3z+oBjM6aIU JI0VJRX7z/uPchD9wiTL70rDL+/aClk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YVV712NdxzrRtl; Sat, 11 Jan 2025 15:11:09 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 522901401F3; Sat, 11 Jan 2025 15:12:50 +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; Sat, 11 Jan 2025 15:12:46 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 09/16] fs: fs-writeback: move sysctl to fs/fs-writeback.c Date: Sat, 11 Jan 2025 15:07:44 +0800 Message-ID: <20250111070751.2588654-10-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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-Stat-Signature: ad9bmysfaqp8fdcs6penmq54ep1oyi95 X-Rspamd-Queue-Id: 6F8A9A000E X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736579573-921492 X-HE-Meta: U2FsdGVkX1+hMO6qN4Gmafk8QT0yVzhidW2iPoTEEgo8wH7hvzdOpWJ4TfhJzqHTTJ6WRXkIhwrT/7ZPa0UJ3d8WJp6/6LRcBbSKwoROfw5rI2TMQQjh+HmTzUtAJVdBqx7L/ONSbFNLUnqd6gYu/hCmqnZJrScGs6sMxxCPURm4K2rXaKV+h5i2ZhDHKmUnrkyO0zG59avUm9RMX0x211/oy9057LzYpS2aUkfCFtXPQOdAlCGWk24EzVhWZL4zi2hmVJpEXLDYHYVvfb9DOHw/AMqrsLCnsjp9TCjDcAbtrmoS+UkNFubPVq0yyBxrX7+i0qMKdETABeeKyoXxzHWLhQPIJSwnBLWdBNaUd3QEEfaMHybCsS7NiSHmTHLrwEgkuRlXzHxeP5YlC2EL1wWh1s+zIw98atj3X87HP9rPE8Dk1Oaf4MLxPTxp13FTQXrjgGncgkowUXsMqWFZT14CPV5WWpm2vqvPRdg2kputNHqyi4LnxpiOnU2Q6drhge8KhHcP0Vx33PceyFKuAYZ684o3O4dr2jYIy2IXvjpwWLZ6+kG6I0Htrm5b04inHKWxKjdCisEKGFBAIewVXBgM6sRJfqv0P9WFgtnn0gbWxP7Fr5z1el/KHr0gEqxOR7UICt0lK+J1PUiHepT4Mtq19xDULrCb0CKFGaPaV04s0Ucx8TzXmQvJP3JQDjQPJ/kjC7rxJ+jS/1DYpS2er7VjP8rZxLCkPr01+7hnVlRX99Y+NsKspAKtHAUuCw1iRQIcsaftp+XhsIYZpa+Fzx2ReaxhVgN3cGOSV5tCKNfRqtyir0teQp9NaTzT3M7TfAwqvUrJ4tQaqJ984MG3nNiG6fkIDu6wbMETO/vmrZPQnHLzU+0zPTI016rqIRZJrdyeLx3//r3NkecODQCCg1zHyiFgpf87pmPb5Mg+Etcimf8Wuq7Qc7P283cdBERKxdv511X+zB9Oseg9MU7 LPiq61Po VXLTgI0+rYH9kcMfUS+5sx4Ce+7E9VV/TIUVD3LC/P5Dj9WOMe1GB0nweSwN1uLWbe3k5l088JYzTQMZE1kocynX6wiXD2JHYWeK63N7bc8bBEVaonqgzc3pLUILeZ8UODpBeXPKM+hBs6LdbABhcpd07kZB6wLy3Y5RGhdeWXtIuKR04FehAgvSBdF8R6p+/LkZtNStsuEuyLIC9ar2E2RAkhrv1JCEETJPjABreWKsiN+0ObiYZ2FKoGO3HipV6cZt9+WFUGDeJainXMhw26UEpEuLKOmnM5kD1YEDrevRaXNt4/u1LCSMDNf4YJORiFcCZLW85fIcxU8E= 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 dirtytime_expire_interval belongs to fs/fs-writeback.c, move it to fs/fs-writeback.c from /kernel/sysctl.c. And remove the useless extern variable declaration and the function declaration from include/linux/writeback.h Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook Reviewed-by: Jan Kara --- v4: - const qualify struct ctl_table vm_fs_writeback_table v3: - change dirtytime_expire_interval to static type - change the title --- --- fs/fs-writeback.c | 30 +++++++++++++++++++++--------- include/linux/writeback.h | 4 ---- kernel/sysctl.c | 8 -------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 5980ac24c7a4..4f907e8dbfff 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -65,7 +65,7 @@ struct wb_writeback_work { * timestamps written to disk after 12 hours, but in the worst case a * few inodes might not their timestamps updated for 24 hours. */ -unsigned int dirtytime_expire_interval = 12 * 60 * 60; +static unsigned int dirtytime_expire_interval = 12 * 60 * 60; static inline struct inode *wb_inode(struct list_head *head) { @@ -2435,14 +2435,7 @@ static void wakeup_dirtytime_writeback(struct work_struct *w) schedule_delayed_work(&dirtytime_work, dirtytime_expire_interval * HZ); } -static int __init start_dirtytime_writeback(void) -{ - schedule_delayed_work(&dirtytime_work, dirtytime_expire_interval * HZ); - return 0; -} -__initcall(start_dirtytime_writeback); - -int dirtytime_interval_handler(const struct ctl_table *table, int write, +static int dirtytime_interval_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; @@ -2453,6 +2446,25 @@ int dirtytime_interval_handler(const struct ctl_table *table, int write, return ret; } +static const struct ctl_table vm_fs_writeback_table[] = { + { + .procname = "dirtytime_expire_seconds", + .data = &dirtytime_expire_interval, + .maxlen = sizeof(dirtytime_expire_interval), + .mode = 0644, + .proc_handler = dirtytime_interval_handler, + .extra1 = SYSCTL_ZERO, + }, +}; + +static int __init start_dirtytime_writeback(void) +{ + schedule_delayed_work(&dirtytime_work, dirtytime_expire_interval * HZ); + register_sysctl_init("vm", vm_fs_writeback_table); + return 0; +} +__initcall(start_dirtytime_writeback); + /** * __mark_inode_dirty - internal function to mark an inode dirty * diff --git a/include/linux/writeback.h b/include/linux/writeback.h index d11b903c2edb..caf4f0b12235 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -327,12 +327,8 @@ extern struct wb_domain global_wb_domain; /* These are exported to sysctl. */ extern unsigned int dirty_writeback_interval; extern unsigned int dirty_expire_interval; -extern unsigned int dirtytime_expire_interval; extern int laptop_mode; -int dirtytime_interval_handler(const struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos); - void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty); unsigned long wb_calc_thresh(struct bdi_writeback *wb, unsigned long thresh); unsigned long cgwb_calc_thresh(struct bdi_writeback *wb); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 97f9abffff0f..c5527f59e3f2 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2014,14 +2014,6 @@ static struct ctl_table kern_table[] = { }; static struct ctl_table vm_table[] = { - { - .procname = "dirtytime_expire_seconds", - .data = &dirtytime_expire_interval, - .maxlen = sizeof(dirtytime_expire_interval), - .mode = 0644, - .proc_handler = dirtytime_interval_handler, - .extra1 = SYSCTL_ZERO, - }, { .procname = "drop_caches", .data = &sysctl_drop_caches, From patchwork Sat Jan 11 07:07:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935841 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 0127AE7719A for ; Sat, 11 Jan 2025 07:13:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8F7E06B00AE; Sat, 11 Jan 2025 02:13:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 880B26B00AF; Sat, 11 Jan 2025 02:13:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FA516B00B0; Sat, 11 Jan 2025 02:13:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 492316B00AE for ; Sat, 11 Jan 2025 02:13:00 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C29D3C112D for ; Sat, 11 Jan 2025 07:12:59 +0000 (UTC) X-FDA: 82994304078.24.AE33200 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf29.hostedemail.com (Postfix) with ESMTP id 4C848120004 for ; Sat, 11 Jan 2025 07:12:56 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf29.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579578; a=rsa-sha256; cv=none; b=kD95/3DrgQd3rzqDnP0xTIqLz1d1yTnt2YTDQopLNRmCxiOKSYk2oT+dlKoujuv3AZ+0Jw ufcyB51Ip6T6zF1epybjudLumB1B4TxwpLChRIXhx8++dBQxI3glV+Q5SYn6FGRlAACpVx t3BTYWSbmSORdnVEM0SCEfhjijVsmWU= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf29.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579578; 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=WreX7GUmbJjdCEp+I36e8/ZNrB4xEScOoakrMlLbvIs=; b=KLtICE+1g8LaDEfLuVhXm163ZlTKiWENTPELotGali2/nV8blVGNiacdbNhe6/PUQ3muFT A6B1NGS/LQjEyCwQgba8d03nO5v7r1UHeoO08nq9x1msAmcj51mC2Wfepi845GiICv71FW AIuXQEipuOauv9C8qKNrE16UL3SI5QI= Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4YVV5S14prz1V4Py; Sat, 11 Jan 2025 15:09:48 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id BEA0A180043; Sat, 11 Jan 2025 15:12:53 +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; Sat, 11 Jan 2025 15:12:50 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 10/16] fs: drop_caches: move sysctl to fs/drop_caches.c Date: Sat, 11 Jan 2025 15:07:45 +0800 Message-ID: <20250111070751.2588654-11-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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-Stat-Signature: hpms3nr91bpwwkn1n1c3o56xkaokt6gk X-Rspam-User: X-Rspamd-Queue-Id: 4C848120004 X-Rspamd-Server: rspam08 X-HE-Tag: 1736579576-562716 X-HE-Meta: U2FsdGVkX1/gl17/wAQ8gnnGwQLfKtEXcaGpRnAiNmb7qxcaUyQlwgEkw4ddIUHFPJshbtXOvVFP1wflHgHk40MAk//ve1PU56adjgt6CN18Y1LZKyhYT0JgWevg7E86oCVPtghjZMh23qNnIx8bmFPPMNu3IuKlU75C2S6e4+086eBLKiVz+hppBZHOWXAXXBDeNJvYZDulWWXz3fI+WElIBIrQVp7HsG3eqNDJ49ZgctOn/QgstQ2zTxAvOCmqSSVp5ZktI3Ve+pdIDXIxGLrRGCxAR8fiCRu5GmuAvet3phxNVJxwRPdiKQgETe7fIS2kyro92np2mUMfXUI4WC7IZ+o4PATUQ/C+DJf1c7fAEa9/q+RXFpRV+zjlRxlI8/cvVSdjxCxRxnA6pAIA/kyI2WfMprIKU6F7euShimmuK3n74fA+/wkKbRwJW578IyjpaP+BjJF4Vux7B7IPuQbvbJd+lE+ND+J852PbP7lm7COFdZ9ivJzXWqbGZPjFMwbbz3FrrH41R+OLs6U4GEBpz3e0nToP7IHbjtHYI7aIgmeYBmSXPXnskp8cLnXTM36QwCL2DeSBnqPNSoNph5jqbx10zm6nQrxCCEGjz2YVNm/1RV6pla4dQkLiBgmYWnbSiPrTh937TUwZbFwd0Bubn5WB3xMRL8gz4y9DB4fvUrRrO8tZ1eYsq2gR3p85Vw2qXd8Bgg0sp6sTrCZE9bk0mVve49JI7Dh09Q3jqy8sR8WwBbhUXYSWPQXrz50yP5Lbql1RChT1Qb6SGlBbllV9qQAjLrVChVtjO4qB8ptOui3I9tmXg0Sl0787tvDS4+k78t3yZYH2uYt0DCSY53/mY6BAp/iQeJK0g7z8uhNYfy/FCyymo6ew/bO2rPyF3qVvYcgWeC7Um7RH1uKU4rLIuviI3P40EbnISJxVAKzD50cBJCkPzJR2OAvzatTKvppeIUAsmBaaix6DqF2 ppG3PfrY UN1O9MSQde9EjJ5WZ/YCKhNEK4xh/x3F8wPTb78ylJLuxEFz/x9vcwISbkZtCat9rV/UXHPWAq/mQUYMe6QLJdwKfYOrLi+YgUwyFNoPmXiTE7DHEX5J7IJ+mgoI9b1qIHYIHeWDjz9dN4N0DzaUv18dTB0ssvcO7h2DgLXyZ4uUqvH4cVhbSzonaxMURBAJ/qT64kRjRLGvfe9aYxRAh/wfer+QvbDb6bDmh1HB2Fm9ewA8qXoghWXeX9yEfs+T10wrQZGl7ZhJWpJVG4E3G8zFnpT9pgMorITFBkfjW6mz+/kzCF3RE4vbU6QOBfoCFA/l2/5j3+661Nx2/rvhvg1PtChz6djzENRe4bi1/iXt7u7I= 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 sysctl_drop_caches to fs/drop_caches.c, move it to fs/drop_caches.c from /kernel/sysctl.c. And remove the useless extern variable declaration from include/linux/mm.h Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook Reviewed-by: Jan Kara Reviewed-by: Christian Brauner --- v4: - const qualify struct ctl_table drop_caches_table v3: - change the title --- --- fs/drop_caches.c | 23 +++++++++++++++++++++-- include/linux/mm.h | 6 ------ kernel/sysctl.c | 9 --------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/fs/drop_caches.c b/fs/drop_caches.c index d45ef541d848..019a8b4eaaf9 100644 --- a/fs/drop_caches.c +++ b/fs/drop_caches.c @@ -14,7 +14,7 @@ #include "internal.h" /* A global variable is a bit ugly, but it keeps the code simple */ -int sysctl_drop_caches; +static int sysctl_drop_caches; static void drop_pagecache_sb(struct super_block *sb, void *unused) { @@ -48,7 +48,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) iput(toput_inode); } -int drop_caches_sysctl_handler(const struct ctl_table *table, int write, +static int drop_caches_sysctl_handler(const struct ctl_table *table, int write, void *buffer, size_t *length, loff_t *ppos) { int ret; @@ -77,3 +77,22 @@ int drop_caches_sysctl_handler(const struct ctl_table *table, int write, } return 0; } + +static const struct ctl_table drop_caches_table[] = { + { + .procname = "drop_caches", + .data = &sysctl_drop_caches, + .maxlen = sizeof(int), + .mode = 0200, + .proc_handler = drop_caches_sysctl_handler, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_FOUR, + }, +}; + +static int __init init_vm_drop_caches_sysctls(void) +{ + register_sysctl_init("vm", drop_caches_table); + return 0; +} +fs_initcall(init_vm_drop_caches_sysctls); diff --git a/include/linux/mm.h b/include/linux/mm.h index 98654abef3b8..3ed6f2600abd 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3873,12 +3873,6 @@ static inline int in_gate_area(struct mm_struct *mm, unsigned long addr) extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm); -#ifdef CONFIG_SYSCTL -extern int sysctl_drop_caches; -int drop_caches_sysctl_handler(const struct ctl_table *, int, void *, size_t *, - loff_t *); -#endif - void drop_slab(void); #ifndef CONFIG_MMU diff --git a/kernel/sysctl.c b/kernel/sysctl.c index c5527f59e3f2..7fb77cbcc24d 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2014,15 +2014,6 @@ static struct ctl_table kern_table[] = { }; static struct ctl_table vm_table[] = { - { - .procname = "drop_caches", - .data = &sysctl_drop_caches, - .maxlen = sizeof(int), - .mode = 0200, - .proc_handler = drop_caches_sysctl_handler, - .extra1 = SYSCTL_ONE, - .extra2 = SYSCTL_FOUR, - }, { .procname = "vfs_cache_pressure", .data = &sysctl_vfs_cache_pressure, From patchwork Sat Jan 11 07:07:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935842 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 2ABB4E7719D for ; Sat, 11 Jan 2025 07:13:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B43726B00AF; Sat, 11 Jan 2025 02:13:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ACAF66B00B0; Sat, 11 Jan 2025 02:13:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 96DA76B00B1; Sat, 11 Jan 2025 02:13:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 765DC6B00AF for ; Sat, 11 Jan 2025 02:13:02 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1D08CADEAA for ; Sat, 11 Jan 2025 07:13:02 +0000 (UTC) X-FDA: 82994304204.13.04DC648 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf12.hostedemail.com (Postfix) with ESMTP id 0BA1A40003 for ; Sat, 11 Jan 2025 07:12:59 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; spf=pass (imf12.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=1736579580; 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=nqyhYC9VHRbpINjzAU6rWoUpGKxiH+bHUC0qsLRtufg=; b=sbKE4OSMhkwyZzXHfmRWq1GAsNH4bgSZ8MnE9NstNhU1A1KwRXBf3pJw1za+h6LaMM1iz8 L0K//kRIjQKHrUaHwB3N/xmPDtULaDT7a7mXpkayRRLPKO3KIG0Fyc2jXB7mPVf+/5TGbv elUyW1EdLC5tS67Kgs8Mch+9DrlD9yI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=pass (imf12.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=1736579580; a=rsa-sha256; cv=none; b=4qUdArYcL+Id5SDXiZ348K6EyXS2DvTi1cnTw+h3oNVc9ms8COiZYjZtv7fIzNRxhlJ9Xp 84a189rsNszmV2vUuWNghmTb4UpcXM8DWvjSIGSsTTwOSy44SXEQY7ziqO9GFPQe74GopU sVgEQoI7eRZpvyb5/+Op+wqXyD0+Mrw= Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YVV781PtbzrS4W; Sat, 11 Jan 2025 15:11:16 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 30F2E18010B; Sat, 11 Jan 2025 15:12:57 +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; Sat, 11 Jan 2025 15:12:53 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 11/16] sunrpc: simplify rpcauth_cache_shrink_count() Date: Sat, 11 Jan 2025 15:07:46 +0800 Message-ID: <20250111070751.2588654-12-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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: rspam06 X-Rspamd-Queue-Id: 0BA1A40003 X-Rspam-User: X-Stat-Signature: 6owbhg3snakm9gd936yu1oaeafb1jue1 X-HE-Tag: 1736579579-987622 X-HE-Meta: U2FsdGVkX1/SDr9jCxT0QW42yjry5j2/9WEtxeThvqHGW9UvMqVv8pXeMqeIazgDRiCS+9/IIdMeWXPo9PHtFSS/ZyMVWy8fMk/JToc2vgy7GwfDUDh/K5e7fuI37imxlVWTAnGEDhBsHnrWX+p/ldhwFRVkma0I56C/rKdQ14Y6zWUCIrS+mthnu6ezIHIgY8iceNanH3u7iYKAVMb0KBepyUIJSm+QtG82krVScx8uFnpddypfCLUeJzpocaDFKuDjelaR4UOXlw4DPQKnaIp2zKYoBa11PI1t/r9LktTKuFNsVXZVYVoUfkHnZSat3eSYgiRrBpMEIHSpfjNCHvyZfwjNuT3IMk3uI0Z+TNfKXNymw/6OxExoJERpdJ8Oou1AFov+USOe9eLPlsjIIOMSWqo/1RMBOoMyyvxpQswNmH5nIn+GkN01C7I5Fzua8pJL8bcIk/DRY1kWXe118AX9DCTUK0wraBMyvHUXGPkELHSQDSrCJRkSG50FojcF4M5xRkRbb1z+PRTBaedLDhVKC8ReMgFwLJRp2Q3Jp+dqrzNjjQ4g98q8A4hH+JwrdHgtegVgVDcDYegMuzuGoiEA5fmalSNyGbViBfiRSjnN8TDJexUxlVgilzNUt1jlwcn/s48Pwy6DcMFhahgTLkHofN2ZArZge3W3niJvOOI69+tHsqir9ti3gl74TjNiTfrVSKD4u5HfYiM0RJkZHOvvk9S+Y713aGz5R0KPEdhw7QLlta7XJfoZRwLTi0ip2lUBLD2WF9frqWhanyY17kWk3JyUkmLU/Tm5Q2fLIH3FPOrjoaZr9kgfO5GnTL3P08dvb+pQXolg61A7TvPuV+DNHJCQQq23LnTzjh1jSHg/mNeV83RurjFNbdES98hcwHZK/B/t6v3w/NLwP5iv6xa2j4vX4v/vNzVCr3eC2VosGyEMUj2pBuY6EIBfiNJotjYPYDvhbJPx5d7/9vP GXlj9t0P TqgJ/4ahj7lmK/NKZ+NACsp7KDuDeisP3MYX8Qc/FEW5QB+3sLD4bEeMKlyeuof6yq5SemS7x88rKMa8ORrM+/7XtnnBsdIqQ5RXA2Um2v+PtFgL++QJEo1frn1uBKE35/qw7NHJ1wk6wdHNrz2tOWqbBJWd/G6JNNpKyVZEZnH3FhhVyTmqLNtIqQ0nnLsQVDoLizmmFrHDSgxGi3AbLq63tvVgFPUDP7vGtM61ssdOIv27sdi28iXEQ/1GhaRYNRMrZA/f8KQKe9XcJ7hPFO3UDCmgAamGWwz+ADvMlJOhh8CLoWCmqfPy+Yf+EXoXgMnNOKEcylUbO2PvCVqnQ5HG8UaqSWEb2VSMjwKNtMcqd5sMrt9l4hP1nee0UKPyYm24ZaHLPI6/oj1s= 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: It is inappropriate to use sysctl_vfs_cache_pressure here. The sysctl is documented as: This percentage value controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects. So, simplify result of rpcauth_cache_shrink_count() to "return number_cred_unused;". Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook Acked-by: Anna Schumaker Acked-by: Jeff Layton --- v4: - Simplify result of rpcauth_cache_shrink_count(). --- --- net/sunrpc/auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 04534ea537c8..5a827afd8e3b 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c @@ -489,7 +489,7 @@ static unsigned long rpcauth_cache_shrink_count(struct shrinker *shrink, struct shrink_control *sc) { - return number_cred_unused * sysctl_vfs_cache_pressure / 100; + return number_cred_unused; } static void From patchwork Sat Jan 11 07:07:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935843 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 0C3E1E7719A for ; Sat, 11 Jan 2025 07:13:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 946746B00B3; Sat, 11 Jan 2025 02:13:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E21F6B00B4; Sat, 11 Jan 2025 02:13:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D3DD6B00B5; Sat, 11 Jan 2025 02:13:06 -0500 (EST) 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 4A44B6B00B3 for ; Sat, 11 Jan 2025 02:13:06 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 05F06810BB for ; Sat, 11 Jan 2025 07:13:06 +0000 (UTC) X-FDA: 82994304372.17.26A888E Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf16.hostedemail.com (Postfix) with ESMTP id 9E8B718000A for ; Sat, 11 Jan 2025 07:13:03 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579584; 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=iG1btJ1mUTZm1Q/QXF8tiuwQRU5p8WJAy3Rzeg9lzIU=; b=ys4CWjQjTBgF0mnW34v7oGQrYSeQIwJEJhQb3xzVRpWvlcoe/7vpUDCIYzpb9z9I/beFIB EAK/dEEYRMd3K47/bubw4y8keEFuXml8Czl2gGFdblL0tBu69UiN+pjurMnnqcUmEKdODN 2COZo7MHFEBNf3LYgoaD0DJXO+btmFE= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579584; a=rsa-sha256; cv=none; b=q0sEYOFqk/Iw7dkpaLcsQ3tYyarNg3/NpDt9Uavb2f1rPPAkF8BYH55Jkbq6hvw3gaH492 kToFx83hMeRMYDaHmU7P3S+xzQKj8WwvKqvQjXBba0ARBqjLg1BFn4mY9wEyWqjJKPsHjp cM7GWg4DIdR0Euh1jf7k9OBPHGg1+TE= Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4YVV6V3XMGz22knm; Sat, 11 Jan 2025 15:10:42 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 9869F1402DE; Sat, 11 Jan 2025 15:13:00 +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; Sat, 11 Jan 2025 15:12:57 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 12/16] fs: dcache: move the sysctl to fs/dcache.c Date: Sat, 11 Jan 2025 15:07:47 +0800 Message-ID: <20250111070751.2588654-13-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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-Queue-Id: 9E8B718000A X-Stat-Signature: shipxzq1q9qgkyf71wc8ii46fhienc55 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736579583-442338 X-HE-Meta: U2FsdGVkX19xbsYUWqfGPIpBSsniPvLfvNvtoUBEiFREAtZ1jR9uDuLt4MvZiJJ3GYp4SV3yl6L+W+lMihazsLaYpKKYZ+qH50BbbVGBuS9C82mz0ulpqDg7nui3PrUm1Obs+43q4N+wLKxGfZe+dkCx9z+ybSesT5w41Tr/qDsCdpuohCPDQHuW0xJeFEqKrWUVBrrDWuNuevVY9Z1JwfyzeM5X77XmiQ8gdpvfrM3aMTwwHPPW/CTdQZI98IOgCDwGsWYR5YVYLsVnzw4ImFJAI6BjlH2d9GgBsyjnYQy/85z0sdxCUstKmafDDNjHwzbS1Mmle+WqnF8Sv/P941yLVgx4Iuk2GXBjAeMCkLnmXxuGnR6x9QD7mQeK8lp6+KsuwmemlOUMxIE10fyZ8RHjOHTmDxjduIHZGv3ED1DLyIFBq05SrhXJjxgTfMZWlBxpObjXX59ycdfpQTIHUEd2V8vO5HNCeDMt8PrbyecFnsKcB92KSREO3sNbJY1E/GiIB6vxIR9QiVJ81AwpD6Urfc06snKFrrxcKXDX5+YUAMabWkhc+I+ej6BvoVoTxmBN90Xx/zxa0M6SQiy1SyQQGkb8YwCMWns/uNqDDC819IG8SX02f49RoNmaohBV2vQOiztAT434QbpZDlMkjPgpBMtfyGs7eIOVHtbrFbGQpVIvGARjvDxf+dLfmQKIT40FlFmN4ZKuzmCBkoULfYXer4D5MLJztHLH1GikIlVmwByA3GgF6BBBftLqnM8eGLmpvRjmcVNKNZOokXZa+FgqHfmKy8vWxpiFvrFOam3P4N/++HRVdlqA+C/37gD1iWBJJLSCtCHU3Xgfd2HhePHj+bEQbbbyvUeC3rWfY3jSsQzeeNLM6f3bY+LQiPg1Ikyoo7SQRFbYNUeRtHfc2w95Il5jbpqFb4roNwVVdroYqS9ZUseF+KHHR/B+6fE273Mc6K5P7LtPHQl5Nqv AEjQsq2m VEzfps4ffH0AGvt6f2EriDDRm//HxMmUgAV49oCmjijfCbqPKxV/nAnY9HrWHl2J2mCGaU2CtQcB8I/a2fkCECpcoi4F2ednBte1aJ0suvpIR+NfOp0P61lpqSvK1vueZ3jkIOEZUn/7ASNvuH26dx6K41FPe9yaX1NPmFGLdD0ZORpKTNiOTTMsPQq5ao1wvsTKJj3PJcx7YFS2x1D4wZinzL3lPIC6gCd9hM3dgaRxP2letb49UPAcn4bl+Bmnt2uUOMjUl+qqsJo7/hoMeANw5dTsUyIbfURdt2TTi8mU97E9UDA8zZ30PSA5UX/jg+dUTBlxkFNGguY4= 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 sysctl_vfs_cache_pressure belongs to fs/dcache.c, move it to fs/dcache.c from kernel/sysctl.c. As a part of fs/dcache.c cleaning, sysctl_vfs_cache_pressure is changed to a static variable, and change the inline-type function vfs_pressure_ratio() to out-of-inline type, export vfs_pressure_ratio() with EXPORT_SYMBOL_GPL to be used by other files. Move the unneeded include(linux/dcache.h). Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook Reviewed-by: Jan Kara Reviewed-by: Christian Brauner --- v4: - const qualify struct ctl_table vm_dcache_sysctls v3: - change the title v2: - update the changelog to call out changing the inline-type function vfs_pressure_ratio() to out-of-inline type --- --- fs/dcache.c | 21 +++++++++++++++++++-- include/linux/dcache.h | 7 +------ kernel/sysctl.c | 9 --------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index b4d5e9e1e43d..77ca6e9bb71e 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -73,8 +73,13 @@ * If no ancestor relationship: * arbitrary, since it's serialized on rename_lock */ -int sysctl_vfs_cache_pressure __read_mostly = 100; -EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure); +static int sysctl_vfs_cache_pressure __read_mostly = 100; + +unsigned long vfs_pressure_ratio(unsigned long val) +{ + return mult_frac(val, sysctl_vfs_cache_pressure, 100); +} +EXPORT_SYMBOL_GPL(vfs_pressure_ratio); __cacheline_aligned_in_smp DEFINE_SEQLOCK(rename_lock); @@ -211,8 +216,20 @@ static struct ctl_table fs_dcache_sysctls[] = { }, }; +static const struct ctl_table vm_dcache_sysctls[] = { + { + .procname = "vfs_cache_pressure", + .data = &sysctl_vfs_cache_pressure, + .maxlen = sizeof(sysctl_vfs_cache_pressure), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + }, +}; + static int __init init_fs_dcache_sysctls(void) { + register_sysctl_init("vm", vm_dcache_sysctls); register_sysctl_init("fs", fs_dcache_sysctls); return 0; } diff --git a/include/linux/dcache.h b/include/linux/dcache.h index bff956f7b2b9..c81c2e9e13df 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -508,12 +508,7 @@ static inline int simple_positive(const struct dentry *dentry) return d_really_is_positive(dentry) && !d_unhashed(dentry); } -extern int sysctl_vfs_cache_pressure; - -static inline unsigned long vfs_pressure_ratio(unsigned long val) -{ - return mult_frac(val, sysctl_vfs_cache_pressure, 100); -} +unsigned long vfs_pressure_ratio(unsigned long val); /** * d_inode - Get the actual inode of this dentry diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 7fb77cbcc24d..860dea8f1587 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -2014,14 +2013,6 @@ static struct ctl_table kern_table[] = { }; static struct ctl_table vm_table[] = { - { - .procname = "vfs_cache_pressure", - .data = &sysctl_vfs_cache_pressure, - .maxlen = sizeof(sysctl_vfs_cache_pressure), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - }, #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) { From patchwork Sat Jan 11 07:07:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935844 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 F1114E7719A for ; Sat, 11 Jan 2025 07:13:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FD9D6B00B5; Sat, 11 Jan 2025 02:13:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6927F6B00B6; Sat, 11 Jan 2025 02:13:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B2A16B00B7; Sat, 11 Jan 2025 02:13:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 24EFF6B00B5 for ; Sat, 11 Jan 2025 02:13:10 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D13E6810B7 for ; Sat, 11 Jan 2025 07:13:09 +0000 (UTC) X-FDA: 82994304498.04.5501535 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf08.hostedemail.com (Postfix) with ESMTP id 76D7016001C for ; Sat, 11 Jan 2025 07:13:07 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.191 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=1736579588; 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=w5gugbKQv5qJMbtMVTyjmHdyAVsCPAIp1jW4YKwC0Po=; b=LZXfX3J+PvPTRPjk2685kNM2/f92J+/JzEht1n3XF2H/v5jJnY73v9kq9LjfRHmPXqC9v8 dv+ka9MAVocUSEFxEPE3mHg3RElRqadPTMEqcxO8LaJ22usU6zZe81TqSvCBiGp4xmrw4b nyppl0TO/fmFvCfp53HxvhobJCyNOr8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579588; a=rsa-sha256; cv=none; b=dXG2xmT2iMjj+Dwtbot/sxSR1jqq+Iex1smXZ5a5dVXK/HxOrPPH9Ds8ld4EwdcxnZVHgD NRD5c7dx4mz/CEd1Y38nlolgFfsNGJert2edSHIPn+JYeoeIqq9pylIJUOq3rGTSJ1dngS 02PcTKngZ3X9vFpiJZolB3XR4Z2H+9g= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4YVV5g1tqpz1kyCf; Sat, 11 Jan 2025 15:09:59 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 19FA71402DE; Sat, 11 Jan 2025 15:13:04 +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; Sat, 11 Jan 2025 15:13:00 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 13/16] x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c Date: Sat, 11 Jan 2025 15:07:48 +0800 Message-ID: <20250111070751.2588654-14-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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: rspam10 X-Rspamd-Queue-Id: 76D7016001C X-Stat-Signature: 1naapggr5xkxgfrzgajczrqy3b7uhw8k X-Rspam-User: X-HE-Tag: 1736579587-475347 X-HE-Meta: U2FsdGVkX18I96btyrwnxTnH5ZWHC0LoZWQxC+TOoUVSoO9TkulCvhbSOGJ4k5EoZHrJ9vFfCmaX0rn+QSn6nIZ8Cb69jPVebKrDMRhQ9yGrULaOTcvr75MWOrRpZMZx4mDL3ljHyjN0OPuvQujomBqz35rqcJYs9DppbMRuaWdzuC9qBxiTT89xlTybAA+cQQYfWMk/SfjHr9e3PSGHgTOD1ZK2rGfsfpYZ2i5HqSXgLs64IHGOH9HwCIsPyBGCWb6T+DYhIOU2IRoecfVUgqS4KA1U4HQQ63eP86nLPptfWvKFkNvVLwHKAC2uh84cRefEBhL/aif6a1kOkj1UIyeRyPRqL9qTAg7JOYUeRsV+Dlj41w0kqaRg3DghlSKFoezikHV2PRlmWlUh0L3Ag7L2Fk/rvqsJq1rB+RBwvacYjbQlNNaV3cax5UKqEFJOaM08ITnwKDJ7065CkJPA70V7xAkqDso7hqzkgI8n4aeHjFZCAM1QZDjJxnAkJJ9mOP3GC3IM1tTLCy54pEK6HS4b69Ja9iuAEXrW70occRKNORLgx4rFYCGh4KbK6FPI25N+/cR5kyYZiWFTa8uiNfHyor2Nx2cwJJADY3pTdHm1RvbkMOIKgR98p2CeYhgdfgA53XwqeZ2Tkr4k+CxYNGk57O65EojaSTb4uC3gLGAYOM+vAJP8pphsP0iVzI4zM/14ZwcDBakkSsyFh1OhHNAO4Tcj9sLFvd4Eok2CnYIBLaR9YJt6O052s/v7IaD1b23CFTzNDnzQUt3LBDW0B3S0dKcd8JlRwZJgce9AEiNrHsWE+fdGBMFeByXKZ9eYxGoOdYFOQ9XMNtpHP+b3gANtFi+/sJRSodz3F4gHeMGRhq3g03NbDMVWC579vtw8z0VzreZEL9qOxDH8sQPoAPR56Nk4uaLv2lNnhkeXXnaPSSoOZmNCyLz7kHGxKz0NiIHVmtueWZlELEpoLp1 77iTwm6Y X5vSdws7thaUx5yfHLzaqz8F9UcmyfdZ/LYMGCAnr1gcVgQzSg8aMUIylmh0p7vMpAxKx48wwnQUirYBLmD5mBo5RR4K7BsBCx0Dm+VMbUzVd9B3eH42bhE4CRjYtMjv0cOuemKbYqYXZ9QoTuHZrZV8f99eAizSkK5zN 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: When CONFIG_X86_32 is defined and CONFIG_UML is not defined, vdso_enabled belongs to arch/x86/entry/vdso/vdso32-setup.c. So, move it into its own file. Before this patch, vdso_enabled was allowed to be set to a value exceeding 1 on x86_32 architecture. After this patch is applied, vdso_enabled is not permitted to set the value more than 1. It does not matter, because according to the function load_vdso32(), only vdso_enabled is set to 1, VDSO would be enabled. Other values all mean "disabled". The same limitation could be seen in the function vdso32_setup(). Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- v5: - Accept Brian Gerst's suggestion to reduce the preprocessor condition "#elif (defined(CONFIG_X86_32) && !defined(CONFIG_UML))" v4: - const qualify struct ctl_table vdso_table --- --- arch/x86/entry/vdso/vdso32-setup.c | 16 +++++++++++----- kernel/sysctl.c | 8 +------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/x86/entry/vdso/vdso32-setup.c b/arch/x86/entry/vdso/vdso32-setup.c index 76e4e74f35b5..8894013eea1d 100644 --- a/arch/x86/entry/vdso/vdso32-setup.c +++ b/arch/x86/entry/vdso/vdso32-setup.c @@ -51,15 +51,17 @@ __setup("vdso32=", vdso32_setup); __setup_param("vdso=", vdso_setup, vdso32_setup, 0); #endif -#ifdef CONFIG_X86_64 #ifdef CONFIG_SYSCTL -/* Register vsyscall32 into the ABI table */ #include -static struct ctl_table abi_table2[] = { +static const struct ctl_table vdso_table[] = { { +#ifdef CONFIG_X86_64 .procname = "vsyscall32", +#else + .procname = "vdso_enabled", +#endif .data = &vdso32_enabled, .maxlen = sizeof(int), .mode = 0644, @@ -71,10 +73,14 @@ static struct ctl_table abi_table2[] = { static __init int ia32_binfmt_init(void) { - register_sysctl("abi", abi_table2); +#ifdef CONFIG_X86_64 + /* Register vsyscall32 into the ABI table */ + register_sysctl("abi", vdso_table); +#else + register_sysctl_init("vm", vdso_table); +#endif return 0; } __initcall(ia32_binfmt_init); #endif /* CONFIG_SYSCTL */ -#endif /* CONFIG_X86_64 */ diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 860dea8f1587..7ff07b7560b4 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2013,17 +2013,11 @@ static struct ctl_table kern_table[] = { }; static struct ctl_table vm_table[] = { -#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ - (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) +#if defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL) { .procname = "vdso_enabled", -#ifdef CONFIG_X86_32 - .data = &vdso32_enabled, - .maxlen = sizeof(vdso32_enabled), -#else .data = &vdso_enabled, .maxlen = sizeof(vdso_enabled), -#endif .mode = 0644, .proc_handler = proc_dointvec, .extra1 = SYSCTL_ZERO, From patchwork Sat Jan 11 07:07:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935845 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 ADDABE7719A for ; Sat, 11 Jan 2025 07:13:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A2A36B00B6; Sat, 11 Jan 2025 02:13:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 329306B00B8; Sat, 11 Jan 2025 02:13:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A7CA6B00B9; Sat, 11 Jan 2025 02:13:14 -0500 (EST) 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 EA3BA6B00B6 for ; Sat, 11 Jan 2025 02:13:13 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A179D810E5 for ; Sat, 11 Jan 2025 07:13:13 +0000 (UTC) X-FDA: 82994304666.21.AEBA455 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf18.hostedemail.com (Postfix) with ESMTP id 1B4AA1C000D for ; Sat, 11 Jan 2025 07:13:10 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579591; a=rsa-sha256; cv=none; b=Kzr1Fc4FNq6BGMP2pGMLE7uMcQEQEmH20tX/fu1cHEZQ+OMmGb8TPfxPCl4EMphxFAtMOM ZhZ6LpC0WR4cv0ZRRUdQbyMt62zYPf6baUBch7ntzduqYn0+UigsFTsWh4dSUpr2c+tjf2 hfmN65kT7UMTKbPpozDJlB4+uctr00k= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579591; 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=SsRMZ1Rur2Q+IjAV8lZhGg8xCNmRJFIZDihSahWAAfM=; b=NpMc1NAU/BXxEFlfgzt/hP7HBn3GtnmZKLqBVcY0RiA+Act8Pb6QA9XK7G/ljlny6otyop JwGQpR2trPtO8qIIIR0JGjDl2gadWxh7OLPqTJIWPq5b/sdW0WnWqexhx8DinNkO5vuwCM sLJPBreireaAQ+JXhWWbyp+Sn5XVyjQ= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4YVV9k5jS7z2YPj0; Sat, 11 Jan 2025 15:13:30 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 83882140109; Sat, 11 Jan 2025 15:13:07 +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; Sat, 11 Jan 2025 15:13:03 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 14/16] sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c Date: Sat, 11 Jan 2025 15:07:49 +0800 Message-ID: <20250111070751.2588654-15-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 1B4AA1C000D X-Stat-Signature: e74pq4ytydqzbeewdy9f6fkidhismhdo X-HE-Tag: 1736579590-251082 X-HE-Meta: U2FsdGVkX1+jVythYM1KIG12TZwwYGJ9I/LSdK9dgchDQEeZOwo5+KynkQC6buhF5WgVfUu+9Ueb9VkFELBmIDmeA/FwrIwaiJTADwG0L0mIb7eMDTH01Gm+YVl8lo3RO5zVO0zFKiesDqFdXSPZxeFbk1YEGhRVvprt2zFqzz05kQ4cm0uEU6pejWhaVynQbzSB4/cwM/GrMyPIk+NCWMwCPODDG0Tj3vwZLl4T5UMoKdnI6p2a7ylV6ncIV/DZ3lid0jpVbrkwZiqGI63Wz6bxfANPRuKaS0ZvTboDWbpvElopmpuUJYUdgqPLzJ+oX9cgvHiMAv1wagI7NUlpS4ZAFn36JXFO0vGGCRWnNetIuMxx0/0HbyckIHrJmksSz1jn4USpEE/vrrXbiw1VFcnOflduyktt1K5+yh+eknmkJ1MjHH3R2SuX5O/k33YTBkOLIr4k/4Gq/29zBFgm7WDuj6/ffRBvHXaYJ8KBvmRgcAm/BIGgWJMSjA8yaDBc+JXZ+BGeFbkvXVvhLH5z6T+27fVjJijOtD609Kke8B8B+R0khMUQ8wBvAmG2gGXt6GA9V0d46K9NoGseaQdMdSgXgY6FeBzgiLnCpJ7OhdJ7A7+YjuEnHng5jPMIEEW+/YB+1ZIr0EwzgHKxfBTwzFPgOLXEzn4UALmSAzum1Y2nzeMrzcvzq+0S4/0SIYyMTb/K7dbqUMpfdzngjoYsv+yJ36PmUwyzMiD5apQft8IRg38bGqKihGWmQj4UsYStDsdRMc3fUWYywIH0cHbk2HKwqEp1rEA6irJacYt/dZeMzi7uNoYUxoZ399JchPzD4EpCCiCFK4WtVqPevuLc6KnwNyGHluixWucHRRUqdUt6zAlC48sHdmYrQNJf7Cl0Gxca/7t6jfSQE6YFhNbzINKAVLe13faO1gc1HcOvjcuLj6T0OwyeV2rGJXe6XJ6t00Mi1K5Kd05jmIbM3eF fmT/dMkY Qd1br759y+ychH7016k3Hp9KW6RDOkkALHwQtweLxBoA3uFmW0d/WjFdv3IE5w5WASTiqUgY7uAVc/uYSNDVAiX9/UWR8eLORxHlBJDqNS3k+LaiepmhSqDcJVLrOnxB8fp18kG/UMffARMz/cE2H4vALsQzNr070rQBzFm9GNNOowv0= 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: When CONFIG_SUPERH and CONFIG_VSYSCALL are defined, vdso_enabled belongs to arch/sh/kernel/vsyscall/vsyscall.c. So, move it into its own file. To avoid failure when registering the vdso_table, move the call to register_sysctl_init() into its own fs_initcall(). Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- v5: - fix the error discovered by Geert Uytterhoeven. Move the call to register_sysctl_init() into its own fs_initcall() as Geert Uytterhoeven's patch does. - take the advice of Joel Granados, separating path14 in V4 into patch14 and patch15 in V5. This patch just moves the vdso_enabled table. The next patch removes the vm_table. - modify the change log v4: - const qualify struct ctl_table vdso_table v3: - change the title --- --- arch/sh/kernel/vsyscall/vsyscall.c | 20 ++++++++++++++++++++ kernel/sysctl.c | 13 +------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c index add35c51e017..d80dd92a483a 100644 --- a/arch/sh/kernel/vsyscall/vsyscall.c +++ b/arch/sh/kernel/vsyscall/vsyscall.c @@ -14,6 +14,7 @@ #include #include #include +#include #include /* @@ -30,6 +31,17 @@ static int __init vdso_setup(char *s) } __setup("vdso=", vdso_setup); +static const struct ctl_table vdso_table[] = { + { + .procname = "vdso_enabled", + .data = &vdso_enabled, + .maxlen = sizeof(vdso_enabled), + .mode = 0644, + .proc_handler = proc_dointvec, + .extra1 = SYSCTL_ZERO, + }, +}; + /* * These symbols are defined by vsyscall.o to mark the bounds * of the ELF DSO images included therein. @@ -58,6 +70,14 @@ int __init vsyscall_init(void) return 0; } +static int __init vm_sysctl_init(void) +{ + register_sysctl_init("vm", vdso_table); + return 0; +} + +fs_initcall(vm_sysctl_init); + /* Setup a VMA at program startup for the vsyscall page */ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) { diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 7ff07b7560b4..21c362768358 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2012,18 +2012,7 @@ static struct ctl_table kern_table[] = { #endif }; -static struct ctl_table vm_table[] = { -#if defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL) - { - .procname = "vdso_enabled", - .data = &vdso_enabled, - .maxlen = sizeof(vdso_enabled), - .mode = 0644, - .proc_handler = proc_dointvec, - .extra1 = SYSCTL_ZERO, - }, -#endif -}; +static struct ctl_table vm_table[] = {}; int __init sysctl_init_bases(void) { From patchwork Sat Jan 11 07:07:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935846 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 E436AE7719C for ; Sat, 11 Jan 2025 07:13:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74B306B00B8; Sat, 11 Jan 2025 02:13:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AC746B00B9; Sat, 11 Jan 2025 02:13:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FF776B00BA; Sat, 11 Jan 2025 02:13:16 -0500 (EST) 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 2957D6B00B8 for ; Sat, 11 Jan 2025 02:13:16 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id DB280A1129 for ; Sat, 11 Jan 2025 07:13:15 +0000 (UTC) X-FDA: 82994304750.14.3F7D79F Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf21.hostedemail.com (Postfix) with ESMTP id C0C2F1C0004 for ; Sat, 11 Jan 2025 07:13:13 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 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=1736579594; 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=CCQ7w/01MGUd2FzQ58ChHLKca2onWlDkjLjIm+X2h3U=; b=pRGl650VaIfjdsiRHjylEtPjWUg2Y4pCM2Eyp/z1yGyKNRqGWrAUiT3xhenQf7iFLDycpt tyFBlOzoZw8zaALrfE/NPBepfvSkyxK5mT2wqWyOlXkYBaOvF7mzJ/WaGQMKuXZIXO4GSs 1it9A118DJPtYXoM2yT511JFyvdO3VU= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 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=1736579594; a=rsa-sha256; cv=none; b=kA/ptjorTVEHht4+7++jyrZbaURK9xANSh/ECPwK9j1a3KiOzES4pmMWBCB5ybo+OBzdvf vJscFOrhqJ7MgXcG6cqLc2/X+gHlupn8BYrRrb7FR4nAZJJouM2iQd4/tRwRzXP7bGtdUu xxKs5mamiTg5/Y5b1LIVvjbUq2yvcRs= Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4YVV511LZ7z11MSs; Sat, 11 Jan 2025 15:09:25 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id E49F31401F0; Sat, 11 Jan 2025 15:13:10 +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; Sat, 11 Jan 2025 15:13:07 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 15/16] sysctl: remove the vm_table Date: Sat, 11 Jan 2025 15:07:50 +0800 Message-ID: <20250111070751.2588654-16-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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: rspam06 X-Rspamd-Queue-Id: C0C2F1C0004 X-Rspam-User: X-Stat-Signature: g83m658wtbp96413h6ktn38qkkpd96zg X-HE-Tag: 1736579593-244249 X-HE-Meta: U2FsdGVkX1/zkWLJkgs2q5ddxISDmdeDuVzqbvlmCOu/nwibNpv1THyE96mNXumHHIXRcjOzP6fNnJeYScQca8quR1RsiCY3V86xpEIS9IB5Yaas01VPQ+EGc2XkbEImF6OTHrKCk+gVdi3VkH6u68IODFI8LDGdB5Gv/aB3NW9uiOeNAm6SqNk+H/Qa9vR/822fBZMZDqwRhuppU2KAQVts06YvZ1ZgZ+tO59xvWaZ+5xufyjUe+DGZRqatGoUiTFvrtZyuCMDf9Tx3AXKwY38RBK093wFvyr/95jokmPPJ/vF2jHcey/TDzmvwZVjIWIvdCFl5uiCzXFbFLtC8T/n941r0qY3jiRMQYPUxzZjeIUNnusjwyx1D0TbBA2mFLMOTMR/YndYJyFuaqzB4tXem6NvQFLT8DlyjYfGoZ52vh9Duh1L7cPfibkIOI0ZMYe+Va8rdgsTEiBWlkPNhkMd14ejBFLktkIF1BnoIFzQQy8lW34QzhBGwjysIIuV0R8jM/w7tS/r/VfdPTphHDeaZ0bvh42bEG8uLQhAZbKHTI3K62BTsEK5z6Yyzd4ZGby5WeD1moFh9ixt0QNzKLuEVAdkH+yAs90LUCDRCe6mLyj/lzvpKWXdDuOnHvxHHO9e8iVijYyaT3QLPBTKcO17ldOy9jUqQf1Bwfl/0B8YA44msDzfqKTl9eHwLQgzX/EKsIXwobJ+iIl43R8mcpW1ey4+6K0q8VXnTgNtahSCoBD2+nc6mKE9nCwajlL8NLOWZWC9naXvp03E5H6wsGjzWCk8dwilv0dRCmge67jnywKG5PMHpV5O1L5kfOE0IDPuvdud5XwtsgiTUB/POv13AEkC2iNFsbtPGzkB6RGm8E/PdGO464BXnMy51S2SkrTPXBMfhhJlBpUA3LnqCfJ3e6mZ/ZJqQbnJcoUWeb/QqZW6Yq97G7rURdckD77AKS04U0Fj8uLoRqkZCuRf XyHgFhN0 mGJ06KwFNZeW30w9JdgqDfZauY61DwjTppyjaMdq180jzcQ6nIZh+1u/2vTKaO8rOFQpGKNo+ZcEf+Ps1R3KYO0Lg4wxVzlLR6/r84n57xsl4pcUNNP0ovJD77gqunmbnyFdA51weJmEdD/RiwAAtOcJBgdRQWVTg9tDl3S82rDY/p4sMFkr+EBTMx8B7/vTMihf2 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: After patch1~14 is applied, all sysctls of vm_table would be moved. So, delete vm_table. Signed-off-by: Kaixiong Yu --- v5: - take the advice of Joel Granados, separating moving the vdso_enabled table and removing the vm_table into two parts. This patch removes the vm_table. --- --- kernel/sysctl.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 21c362768358..cebd0ef5d19d 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2012,12 +2012,9 @@ static struct ctl_table kern_table[] = { #endif }; -static struct ctl_table vm_table[] = {}; - int __init sysctl_init_bases(void) { register_sysctl_init("kernel", kern_table); - register_sysctl_init("vm", vm_table); return 0; } From patchwork Sat Jan 11 07:07:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935847 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 3B475E7719C for ; Sat, 11 Jan 2025 07:13:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BDECE6B00BA; Sat, 11 Jan 2025 02:13:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B69D26B00BB; Sat, 11 Jan 2025 02:13:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A08A66B00BC; Sat, 11 Jan 2025 02:13:19 -0500 (EST) 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 7A6676B00BA for ; Sat, 11 Jan 2025 02:13:19 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3C1671210C9 for ; Sat, 11 Jan 2025 07:13:19 +0000 (UTC) X-FDA: 82994304918.09.D53FDD1 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf28.hostedemail.com (Postfix) with ESMTP id 2A597C000E for ; Sat, 11 Jan 2025 07:13:16 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.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=1736579597; 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=q5iUf9alx8fXV8NL64WVHdOdYqCO9Dar/iei9FgYKlU=; b=jnSZsQ7czOHR2ZyPnxMRBuUxJWc6cIxzB5lnnCVmVrVaG5oE6igZpuhAlaOzuXI6uIYbHp T6d2A4hsshti/0VTO+FRSyS2akLHUrjHZEnI8kvzOZcsHfejYM0gOcWjmHCkjI5+3Sk7Ro Z+lzMiAL+LB6EttWpbermhZYg5xEyWo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.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=1736579597; a=rsa-sha256; cv=none; b=EATLy4AzS8hjrWQ3mLoZDvXvVTccE7lboanLLsOkYEFRiqEiOkwPKb5NKWhBR5EOKK/O/Z eB558J5ewMrRT7i3lTqw7+x0RUa7+mfi4OLn08+KTYXS1xLxAZxBMNZGH6E2ZYLRUwoeax iV3ek/qnmUnozTrCnFowDP/giYWjrz0= Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4YVV5s2gSBz2DkKG; Sat, 11 Jan 2025 15:10:09 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 619481402DE; Sat, 11 Jan 2025 15:13:14 +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; Sat, 11 Jan 2025 15:13:10 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 16/16] sysctl: remove unneeded include Date: Sat, 11 Jan 2025 15:07:51 +0800 Message-ID: <20250111070751.2588654-17-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-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: rspam05 X-Stat-Signature: 9z147e6q7swrmuk8wdpox9pfm99w5qa7 X-Rspamd-Queue-Id: 2A597C000E X-Rspam-User: X-HE-Tag: 1736579596-189842 X-HE-Meta: U2FsdGVkX1/bHsAepOyRXHdyRZmcCfXUg+LJpexVhr/vQFCRlYBwq1Fv4PsziqVC9/ZaVfo68xk41hTq2Lbz7QKeZ1H+SsmBoClKo49sslfUaCMGcpN/ul+rCD4rcmvTV3JxBbGr/SpxUT0hWrsUdYIR72C+K5KaLGQN22suyCEMHqg99gqZWfjrZLVmCP0poGarT3dWqLG8rCb9uBIzz9vO2a7+j+Ny1I8isMqY1jj1qbpOXKwI6DRKNXg4xRJBjxs5ouLabIOYYu/BSFiRAJW2pT6deJWjp/MUdPLUuGRuoqOpo5EibKdHwFnaKHumRiXwhaQrZErssEKJ8mPBayjFd4b27mFL15i0std8emAI2QDuwA9b7WOdg3VfnFG2QoFDOJIKa5NfTHKHnzd5A0cPd95unmdPqBSkqkSKO3MEs8AXQcM3saBDptwYHrHjg5DO6BkWvv4/OxQNl4J0+pXbtJHrng/RgHkt/JjDyaBalML3nCQOkrBve9oA6QijZb+f9FZyFOiMH2VM2f8B6P6ghliC8zGVNx4kmguVSTQXveS/PDGiltbo6hpe+gsoBwX4JWJG5OhYMZxuLSEWa8mFMPzuPAHD4xXPkuJW+lit8uIiGg8Ys55ux+9UegmwiM5UFAHnAhWqFTU96oAZkHSKF3f4g8v9n7kUqLwqmyYc6cXUxRTR33KHFDjGZ6C1WcoW7U9qOoRbrx+lKmog+dGilAAcbuos9j2QTK4Wh2ONWRKdLdPKIqOytOPatwNtwfiEPIwOeYe+w7AaqdNqZdnWQU9wa7sGO61kaxaoO2MaWSg/CqhLyqlg306EJjWX+NAHP8r0UPTZBxM+/0Ach92SasMzn8ebabU6cfhJbVRVcwfu/cMtPZBOZNIg1sSu8kCljwca4TJKuxQHirbvcOeUTbFlm9Ww5thm8sEAi/6hB1HmU5c9sxSht7Wq/8rpz8bNNuMRmr1ladkcVse tBiAKXUP pXIszyiZmluxSjnI71uZYITLJuJKFS9Sxg3+u1a9v9gI1MtLTDeW8GU1uUHmX4R9sT5VbngHiW8ijQx4GABX7/oFGhrjG+sZLkgjIWqGP+kbOY9Uv0F0f99OFzdDC86weMVQbcWDd22QEWkpNszJDdqmbfh4Fk6dfb2bMFlDtzPxwxBt5ITFn3CQ58MmQJ2DUuKFkpaSNEEDwxxMIumfQdAC2uQ488KVR7S3j7iubdXubkyMAwcVVBX17ZP+TGy+LkS3FKQgc+AkWGk+Vj0FxN080NZLeblVaTGTlE4t38FV5F6GsHyQGJHSKmgPmnxyP8R4NtiEtXhWIlsI= 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: Removing unneeded mm includes in kernel/sysctl.c. Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- kernel/sysctl.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index cebd0ef5d19d..aece984bee19 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -20,8 +20,6 @@ */ #include -#include -#include #include #include #include @@ -30,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -41,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -52,13 +48,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include "../lib/kstrtox.h"