From patchwork Mon Aug 26 12:04:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777715 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 DD2BCC5321D for ; Mon, 26 Aug 2024 12:06:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF2456B04CD; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C52D46B04CE; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 905E26B04D0; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) 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 572B56B04CE for ; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C82BC41073 for ; Mon, 26 Aug 2024 12:06:02 +0000 (UTC) X-FDA: 82494268164.05.140CB32 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf08.hostedemail.com (Postfix) with ESMTP id 3AE32160014 for ; Mon, 26 Aug 2024 12:05:59 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.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=1724673897; a=rsa-sha256; cv=none; b=n0ZFNlYmSRgzobFQ6uMz8sAVJ7Qbrk/mkhQ424v2xtl+mA9k60aoypMy5JIANvHAMdtstL zFq3qzOp24F6zMirW9VQ+4qFKfGl+HWRpyMYbl96xwzAH6SUcb4ncBTS/WkP4+QUUM1s+M 7LLeOd96xewUcSEm/tid/duQ9FuA5nI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.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=1724673897; 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=s+pueQE+ziS82PtFxQ2L1U07XouuPQdg0h3aHWVWwZE=; b=m2U6D61e+3bj3+iAwwmHCG4D3WfZmvlb9PdXq383XE8jfdQmBxTsD/zZ75T0VLtW+Y281M 3EYkaURlZV7h5jIfLPfdH9/C3Iu/CxhSync5skI/L0NMal5GCoWIcOCvLQVV1RAC9AHXwY /ueh6Syy8puq81W1zONLol0rtf+o5Ts= Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Wsq6P4rRpz1HHLX; Mon, 26 Aug 2024 20:02:05 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 4166218002B; Mon, 26 Aug 2024 20:05:23 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:20 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 01/15] mm: vmstat: move sysctls to its own files Date: Mon, 26 Aug 2024 20:04:35 +0800 Message-ID: <20240826120449.1666461-2-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Queue-Id: 3AE32160014 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: aahcpeu19fd6ps9fcqmd1ya4aj4ahij9 X-HE-Tag: 1724673959-559861 X-HE-Meta: U2FsdGVkX1/1gdLA+MipbizlgLhlM1vDMREv2sX0Nz0IpPyj3MH5wxSlZjYcs/BuAfUb//lq1a+3JX0v3F4tJJJ8TYPCJn0o9jpKrS/gytFBr1TYOcyWAUmK3AZI9xdeIG2XqxCXtGJ92oVOHiJfF0l7Aqm0//nlORHHY4i6ifMmNqLT0t0p5cokeUEGTKn9hyyctqnWKBoHEsto4A7BLdWpiPiDidVVQGoFFuY3uBwRnW/S0BekPPYy0qQkTT9PorN4l1sFQlpZ323C+nNIdtyNjp+XozaCtQD3TAEkQGw5SW6wXTN7qqazI90TlPHb3Fam3iELfnsvHUN9et9rKxTASVLZDSm7JZxZmiCkkNwfm9uVZcMBtVXDZLs6FVGm+uZ4TaAhszeEeRKMKo051u5EsnJ05KTYXrN7oVE2DACXPbbsCoHICruhl8PAUfFdbnuCXo33qYCi91HJu8UZQDKM5FHVELqvTaXUKYi/1xiN9B5bR7M89gtEtF0KX3BHmYNAKMAZmjUvvr0gumOOI0tDhxY2aFbY/GKXHTFkLimatzffyEeV7mB5ajpr7s2o4Ksz5FzobDkAoKOTtg/6q0iuP35zCluMZH7bfeo0GnHOSA0d3RRxp5uTGwhY4iG/X9O3PgDFlFLMBO2FcRtqMTWpmDGEMLC4OJmzpkcl+oEJuI4DnqZekJTDWfJHXpb0mmyoLnCCyd0+CfZHEhBPL77S0ARt0/APlU6rN3u9hoT3kzgBKGG9x4EVRzjG/7OpP9iBLHNr8GOjCPLEO7dd8/U0e/a6gghNKNPuY08KCLN23ZcMhQROFu/HWqlnbj9k5C7dlZZPG3srHH9KZKe68lKCJQMtSK2FNTE0GRiVaBfU3ys9h1Jf6+LEDiNQuBPPs8XTqtGreyYgEF1br1iQtgM3bY/MUJ5UJwT7+Qy9X4khqC6e/9GfrRAwvMhocfmM4Jq8ENwCSo50KWxjLW/ rjh+j+Kb ZB3m8r4plVWOgRrVQCD6LJjMfGswNdknI3e/Eoz3qI6rbGhKOeQb0FxhG3zCZJEjeNWiJbxUqT6+/O/Dv6yUFwiwLMKxqg6uxjRNfxu7Swx6dakAdLn0PC7uan4aGSLW7cO4FG3gEg2uKFJXL8iGqf0pC0A== 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 --- include/linux/vmstat.h | 11 ----------- kernel/sysctl.c | 28 ---------------------------- mm/vmstat.c | 42 +++++++++++++++++++++++++++++++++++++++--- 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index d2761bf8ff32..b2ccb6845595 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 79e6cb1d5c48..726b866af57b 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -2081,17 +2080,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, @@ -2157,22 +2145,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 f41984dc856f..9f9d6a92b98f 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}}; @@ -1936,7 +1939,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; @@ -2174,6 +2177,38 @@ static int __init vmstat_late_init(void) late_initcall(vmstat_late_init); #endif +#ifdef CONFIG_PROC_FS +static 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) @@ -2205,6 +2240,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 Mon Aug 26 12:04:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777716 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 27CA1C5321E for ; Mon, 26 Aug 2024 12:06:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BD5F6B009A; Mon, 26 Aug 2024 08:06:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC6F56B04D4; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A08656B04CC; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 53B756B04CD for ; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0DEC9141007 for ; Mon, 26 Aug 2024 12:06:03 +0000 (UTC) X-FDA: 82494268206.23.6475587 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf05.hostedemail.com (Postfix) with ESMTP id 949E510001F for ; Mon, 26 Aug 2024 12:06:00 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.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=1724673847; 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=13XtYRe9zckhNgCun1cwMBmkUU6oTzsYgFWtM1lgJ1A=; b=5O30/e4+V1DYCiYh7OH8xAyOBt89RP5hWs8bT2azKzw6BxWDzYmqHCKUSzZ8hGR3wh1QWC gOI4bp5+7E6jSmWv8BUcXUhidAgC5h3+zjlzNynYpmNSTcq28JIjz8RNhGVV1pQaYWLwHT SGowNi+BzjjreVdC3LPzwign5IVh0jY= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673847; a=rsa-sha256; cv=none; b=nIHMMnERUD8HlQcQwGSzFILHwz/Aowy5UW84FVGFAm7zhJZmzHM7xoZIjG6LYnrDiPorjW ghDCkYGmfToHi+ZncKSk5ykai+biA5+bePB1DBVLKV+yTQ5eJZHoyvzSh+19Bj1YQ+j19N Grj+7myOz2/HQdToMVjseBFGpx51udc= Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4WsqB46qZYz1j7Lb; Mon, 26 Aug 2024 20:05:16 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 8B0FF1A0188; Mon, 26 Aug 2024 20:05:25 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:23 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 02/15] mm: filemap: move sysctl to its own file Date: Mon, 26 Aug 2024 20:04:36 +0800 Message-ID: <20240826120449.1666461-3-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 949E510001F X-Stat-Signature: ybcd74yroqm8ok96k68y8pm8hd9kodzk X-Rspam-User: X-HE-Tag: 1724673960-23590 X-HE-Meta: U2FsdGVkX18o28MrC0Af+2e4MHzn5O/iunaGYaRlT/rAIc3Ht/DmI0Iu/+G6zpuLMJxq+TRbdo3xpy49qZxpOynff77dBcNi6kf8+f5cn3NwYQ5Gy7mdIB2pV1xBvB//XNwZKgCMNKcTbtapGQR9CTwTIk4bkw3UpuRWLynksrIjK/WzLgBbTIDBidGFFr29x2vRnXUGP4ru9RHPFKn7j/JwIJ3aos6t3iT+lqXM0SZkPDIF9AikNV4oskSKNKa/yw1CSP5imCvmi1TSXb9c+luYcpuVKgdbPj2WpbFuy45vKg+LA0s5Dlb3IQqSIPBg0sAEagLNTpgxPpFuFvlOGQZVEqqP3U5Ss3tW8XsC22sS8u+elHGjp4MbCOwyHFi2wPy7QrGcCXJnO+Xora0NUVkFWvMFyejDxT3kSYqoeo2CU6e6DvWAUnFBeZaStEHeSksQUl5IWfuAujWJPlGtGsdISeZNwdeOssw7DDR//iysDbmAyRTtfMTb/6WeZhpwy/C/DBcbrkKDQn5t9TYmbAdqY+Iev9RvrhU68kadTSx+5ll9XBNeg6r622o1QqB2NCNLZ4JjHYmVrOWX27mgTcCOKEwk/ifpwNQPgB9HXm+iZPjROP/Gm9gY2g0/mpJf9V7FWkb757bo0zHOJQeUYc/Wca7PJ7E/WV6LND1m51/Qp295gxqwHSa9LjPVUGer21Ydjf/efSLmp+FMPwEgKao7XdcjE/SKLGmIIm6FMZ+m2PIi8VxMW987HdUEZvYUZIaycrVeGBu+DLijlEk624pIgZ1FeihYjbvtD2Hs3EKGBJOXVexT+1txV+F6iVsEHbOGSwFWJ6oDYu4ZaPBOojPujiini53uVXyxx0RVgKTQVLmzAxL+tg+RfQVk8VsYs0hXAtoy/T6FEO5ffmTALDq6seJNgcp5FAX1gCHphWrPKO8E5YhqrObuX2/eQTit/ij0Wb5G4czcS0V/p90 o4agdoX4 OG5qM9Le2pDbQrb1kW5CjVqfpMPelZkszYPkYwbZItZglKQby+vJHP0uvVCTiFCjMwhyDsdmR6krVF8LJ1Sh5sqSQGtR2/HprYfqQLQt5Rh9eMo1HX7NIYiF6AmyELkROwd2wOs7NHSS4Q/o9Na6g/4j5Ra2Tcff8wqmKrIzW0QkSQSmFNVQtgKyHVQ== 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 its own file, and removes the redundant external variable declaration. Signed-off-by: Kaixiong Yu --- 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 fc111a0a5375..1db4cd7136ff 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -39,8 +39,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 726b866af57b..2a875b739054 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2089,14 +2089,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 0f13126b43b0..72695ccacb86 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include "internal.h" @@ -1067,6 +1068,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 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; @@ -1075,6 +1089,7 @@ void __init pagecache_init(void) init_waitqueue_head(&folio_wait_table[i]); page_writeback_init(); + register_sysctl_init("vm", filemap_sysctl_table); } /* @@ -1222,9 +1237,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 Mon Aug 26 12:04:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD289C5321E for ; Mon, 26 Aug 2024 12:06:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 660576B0450; Mon, 26 Aug 2024 08:06:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EA616B044F; Mon, 26 Aug 2024 08:06:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C7F56B044B; Mon, 26 Aug 2024 08:06:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 10D636B0449 for ; Mon, 26 Aug 2024 08:06:06 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B7905121006 for ; Mon, 26 Aug 2024 12:06:05 +0000 (UTC) X-FDA: 82494268290.04.C027772 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf05.hostedemail.com (Postfix) with ESMTP id 2F9C5100021 for ; Mon, 26 Aug 2024 12:06:02 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673920; a=rsa-sha256; cv=none; b=6KI3aKG3JU5kuzOK5Uhq04hyrdvxPBIVJ82q6AH3yLSR4i3OlVToyFigsEt0dSMPDmR6Cr BI21qrGNSZYL0v6WyKztuUWNBbHFO23k0wSWQYQ7roCxK/4+m3zhsIxJEZavt2LFgj3J3D rGkpv6xNcedl9CW17QLBdC7ssXmlt3Q= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724673920; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sXNt9YDqUtLmk0cHgRPfAA9sqVVCfXu1mKjzdspGC3c=; b=UbNvwFPkw6n8H1TXW4FY0M9i7cxv77OwTJyzQeqhT1J283w3jxl2fXyFL+kCo3ANoQYWjz QbrwwYdinqd3CbzvlR7O/zO0MTTFF5+sTra0yA3gFzGJ1e3DLZZb5DjbvAyTi8Bi6DB08G pr7Ztj1Rz/mECJfIAJb8DwcJRpH8IjU= Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Wsq7w6cqYzhYWK; Mon, 26 Aug 2024 20:03:24 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id D6E961401F0; Mon, 26 Aug 2024 20:05:27 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:25 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 03/15] mm: swap: move sysctl to its own file Date: Mon, 26 Aug 2024 20:04:37 +0800 Message-ID: <20240826120449.1666461-4-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Stat-Signature: mheeayjhunznzwz8ofo5ccwtha1x6t8o X-Rspamd-Queue-Id: 2F9C5100021 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724673962-222148 X-HE-Meta: U2FsdGVkX19PwTR8xw4S9OL1A6bwpbaLbY44XmpgyZlft3yPnIx87p0E7IVQow7RJvss/9vcMZJK/YkUiJ0AChzI/tk9dM6c+n9kxGfivFO0Pa7jPNMJp0oBM0N9N8Xj6wcd/sj5q7lpbCKzaR65wgE8VoVh4Buc46FD2t+slEuBL2m/IJaFuaYGLm+xvCy+iRBdfqLEANhBruNnuCiY7WEAHSD/SyYzxEKU4EDtBx6omWppA473n+hfuYnR0l4ITXfp4strG8aegRWfAwWEghgXL4O3e6i+nt1OIzC5/aFJpXvIvn1P59CCS3/cgkQ8f/lTsejmeFCrgtLcF7trS0reoBrZiy+MlrSd0L/sJj5JWWGcUsFIKT8Ors+Dt5F0i2kd+xTJfsRcKOtz+pZw4vAVJUnGEPby6+4hmz1KND3a66nvFJwynQb+jFVMM8rvo+EbHdJcAAhb9DtZtqSHQzKaHRuZZXYJbWg9sW1an5KpoMXG/pQI0msNL56R5yulY1QRCM4jNtEzuzuUL/v/NPUjficj/ZwbMIC3mZdoUx4cbGxSsCfRsYNSoh9loEbGFI1lbtKL12Kn8F/LCCwwLq+d4zj8Uxeuj9rFP5e5nU3xwiINQ9pofx2tDDV8f3sqB13v210qMZTtasa+pt6KMTTShdWVfNVMWn5wsBeBDNMndz/XeNVdOHP770wtyihuRgNsVaSiixm70ISe4/8BSnC43iHW1yD2BCiuz/5U1I6AZimYpC8srUWfCRapv/h5dzaSZjjIWS92bxW0njpYk3Dxcw7/sBMmKDkQS6H53+UOcXNePd5JUCiN2/v9wbFvo/QyqPUlqdI1c/cShRQijhaY7h2r9FrGCeuQg0zMS00lnSvMYs/pTnlDn3awbsi8u0oy/yXp+aXU80yLBvrjBKcVVn2FwLhK2CoTPK+6KpYY2y7n/J6RtdcrnDHy5CFS7UquqJg0thvCLEok/wO 0zb9mJi7 hvSIgZTuHyrYMujwaC4aE4Da3EIjskCQ02Qkrtuze5NOd858KSzKsfRNPmoj8vwavK0dVOLk7kfJZ8LIw7fWv149IuYlb5kywXpgEI8bJjvglSLBvCeDA1GONFiiOB4FPFh0ege1sipVcG8+ndckSIGK9IDM3Q/MW7/9CzhD6vBOq+7UeY3pUeoFwCA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The page-cluster belongs to mm/swap.c, move it into its own file. Removes the redundant external variable declaration and unneeded include(linux/swap.h). Signed-off-by: Kaixiong Yu --- include/linux/mm.h | 2 -- kernel/sysctl.c | 10 ---------- mm/swap.c | 16 +++++++++++++++- mm/swap.h | 1 + 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 1db4cd7136ff..ae41092f4328 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -75,8 +75,6 @@ static inline void totalram_pages_add(long count) } extern void * high_memory; -extern int page_cluster; -extern const int page_cluster_max; #ifdef CONFIG_SYSCTL extern int sysctl_legacy_va_layout; diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 2a875b739054..9fad501311a1 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -2054,15 +2053,6 @@ static struct ctl_table vm_table[] = { .mode = 0644, .proc_handler = overcommit_kbytes_handler, }, - { - .procname = "page-cluster", - .data = &page_cluster, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 = (void *)&page_cluster_max, - }, { .procname = "dirtytime_expire_seconds", .data = &dirtytime_expire_interval, diff --git a/mm/swap.c b/mm/swap.c index e0dbfc98318e..f2689ad02ba4 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -45,7 +45,7 @@ /* How many pages do we try to swap or page in/out together? As a power of 2 */ int page_cluster; -const int page_cluster_max = 31; +static const int page_cluster_max = 31; struct cpu_fbatches { /* @@ -1089,6 +1089,18 @@ void folio_batch_remove_exceptionals(struct folio_batch *fbatch) fbatch->nr = j; } +static struct ctl_table swap_sysctl_table[] = { + { + .procname = "page-cluster", + .data = &page_cluster, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = (void *)&page_cluster_max, + } +}; + /* * Perform any setup for the swap system */ @@ -1105,4 +1117,6 @@ void __init swap_setup(void) * Right now other parts of the system means that we * _really_ don't want to cluster much more */ + + register_sysctl_init("vm", swap_sysctl_table); } diff --git a/mm/swap.h b/mm/swap.h index f8711ff82f84..7283593a0d4a 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -3,6 +3,7 @@ #define _MM_SWAP_H struct mempolicy; +extern int page_cluster; #ifdef CONFIG_SWAP #include /* for swp_offset */ From patchwork Mon Aug 26 12:04:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777706 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC9BAC5321E for ; Mon, 26 Aug 2024 12:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC7FE6B04C0; Mon, 26 Aug 2024 08:05:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C51B76B04C2; Mon, 26 Aug 2024 08:05:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACABA6B04C1; Mon, 26 Aug 2024 08:05:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8D2D36B049E for ; Mon, 26 Aug 2024 08:05:39 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EADF081057 for ; Mon, 26 Aug 2024 12:05:38 +0000 (UTC) X-FDA: 82494267156.03.004DD87 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf02.hostedemail.com (Postfix) with ESMTP id 5AFF580026 for ; Mon, 26 Aug 2024 12:05:35 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724673850; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OC2phavSMH/blJf41JUN2nP7ccWaEyK+m9NZkfqILvU=; b=DiO7JQJ5Px6pSmZI3W9PQUh7KItimwivhyUwTUSqJLRr5oMLxawSov/Or0IXiEXUIwdirn QWhzD69r0JdqIiGT8Ta34BPITtHYoqdELLEYJCGpZ2VfUjB1BkPYLx0CygdiW6dn5ZWUkE qGj75Ju/Xxhm/d5CluisP/5ouq9Q1zc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673850; a=rsa-sha256; cv=none; b=49muWfsVv1dk/Wf/t6+JiY8s2hhvk6k8Fndrs1wrMR2ApAXU2lUtU5E/15B+Vh6FkoxFLI 84acf0yLDuWj7K9Bvhy7TZDL9IX15FdGXQHV3E7CaKboueEhVrFzNYWfNngPqg5e4SiN0p M8fCo6h4Wr1LJSGOeLLv4AtI++nVo9g= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Wsq9S4GSfz14G6b; Mon, 26 Aug 2024 20:04:44 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 2F1091800D0; Mon, 26 Aug 2024 20:05:30 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:27 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 04/15] mm: vmscan: move vmscan sysctls to its own file Date: Mon, 26 Aug 2024 20:04:38 +0800 Message-ID: <20240826120449.1666461-5-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Stat-Signature: s4ywm67cr3nifkwrjb99ogwhsy39bcu4 X-Rspamd-Queue-Id: 5AFF580026 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1724673935-364322 X-HE-Meta: U2FsdGVkX18Slnq6A4w+haQDrzTqVMLRYlQZYtfYmPFD4tHBIAKU6Ej3iT/6sqbHWhGWm5XhLRSJv2CxPN2JbH0pueL+IIqAMc223VG3ieF7Jh/wHHjsQogogOTSRRiNl07a8t8Mq8jAoAwN3jIccSjbbnxilRYlM3UIIvwpt3YOch3X/XhoqD1O6xNGsVQJ9wfYghhklRN2ZSuNmJ15mTGvTkmPvIwu5AD9uYdUsl8vs88/g3/VigDse6dUEuacz+1k7sgDOFmb2p/jZEhq61oz6um9KPaRjvsrNzREtUnDqX6ml7A3BlKnMaJl5oHSrshhdYnFapyF3GVHwk1M/4w5aRfgJI/b54DNlov8+N6T21VqRIrAbfn6azE+ZGf+iB1I2Agf/no0BJi4VMHZSzi8XmHzrTWFZZJFiy40uAWjtnhogKxk+7EUwOrDPmulvGICLwk+5FPwICr482nBs80hr8tfXURtm02qopoMcRaNmuJQ/L8GeBBZCO1kD35A3yGQtqFP4FjzZlz5xSbpKuHMp/KI+F/DWrBtzrQ1nmzamqq5xTYjcT7RDMwNtAmrw2ygoW6/p8CoAkDi5DUnOrnmhoSUHaCNNzSvFDmwjTPBaRZEcSAuDKtjfLlF1tCn5GXZA0hKMROhT64XNpH8bMd0ZMVTmwTK/rP5bxNwKJGh6aS/AmRuTd65LbyxvrvMjLoGMch/Vd/+4qykjc/r4rhl+zh98RB3hKchYmBOmIoJOkN+1YpYsFYwSydQ7/9AsVbj2X6TaiIMyzlh+ltogxY/01rzrXCW99QS7ghqLgLOrOuhMESueXR97BHZrq+XiUOoTExaCsKb0CFnkDyhFdpdlAZ4lcKdHei9wU82rA+UY0KLgTYlpZ2uZuCt60POGOsk2LeP1kxDlIwSRWKg33VITYywIUqE6HNXrj0HeZdaahQea07zgUUfb7pbSltheeRQQTC74jQuuqgmezI 6ga8vvOn ouNd1ci6Yuzw3PZEmfHcvBEImYmGl4K3zKbK/uyMyJFZ9QBshaEVtSN6JHwK9NtafYnyPcF5fQxgW9MFxKK11glJDOvJ35YaVLTcRDmy+GRhvV8HPAV9rZtXQZ6+ZSrKkDk5zE/Ns6PTVs8kZ2Wdhham2yg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This moves vm_swappiness and zone_reclaim_mode to its own file, as part of the kernel/sysctl.c cleaning, also moves some external variable declarations and function declarations from include/linux/swap.h into mm/internal.h. Signed-off-by: Kaixiong Yu --- include/linux/swap.h | 9 --------- kernel/sysctl.c | 19 ------------------- mm/internal.h | 10 ++++++++++ mm/vmscan.c | 23 +++++++++++++++++++++++ 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 248db1dd7812..7e6287e64118 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -424,19 +424,10 @@ extern int vm_swappiness; long remove_mapping(struct address_space *mapping, struct folio *folio); #ifdef CONFIG_NUMA -extern int node_reclaim_mode; extern int sysctl_min_unmapped_ratio; extern int sysctl_min_slab_ratio; -#else -#define node_reclaim_mode 0 #endif -static inline bool node_reclaim_enabled(void) -{ - /* Is any node_reclaim_mode bit set? */ - return node_reclaim_mode & (RECLAIM_ZONE|RECLAIM_WRITE|RECLAIM_UNMAP); -} - void check_move_unevictable_folios(struct folio_batch *fbatch); extern void __meminit kswapd_run(int nid); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 9fad501311a1..184d39944e16 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2061,15 +2061,6 @@ static struct ctl_table vm_table[] = { .proc_handler = dirtytime_interval_handler, .extra1 = SYSCTL_ZERO, }, - { - .procname = "swappiness", - .data = &vm_swappiness, - .maxlen = sizeof(vm_swappiness), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_TWO_HUNDRED, - }, { .procname = "drop_caches", .data = &sysctl_drop_caches, @@ -2117,16 +2108,6 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ZERO, }, #endif -#ifdef CONFIG_NUMA - { - .procname = "zone_reclaim_mode", - .data = &node_reclaim_mode, - .maxlen = sizeof(node_reclaim_mode), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - }, -#endif #ifdef CONFIG_MMU { .procname = "mmap_min_addr", diff --git a/mm/internal.h b/mm/internal.h index e1e139e412d1..d396b201e636 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1031,9 +1031,13 @@ static inline void mminit_verify_zonelist(void) #define NODE_RECLAIM_SUCCESS 1 #ifdef CONFIG_NUMA +extern int node_reclaim_mode; + extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int); extern int find_next_best_node(int node, nodemask_t *used_node_mask); #else +#define node_reclaim_mode 0 + static inline int node_reclaim(struct pglist_data *pgdat, gfp_t mask, unsigned int order) { @@ -1045,6 +1049,12 @@ static inline int find_next_best_node(int node, nodemask_t *used_node_mask) } #endif +static inline bool node_reclaim_enabled(void) +{ + /* Is any node_reclaim_mode bit set? */ + return node_reclaim_mode & (RECLAIM_ZONE|RECLAIM_WRITE|RECLAIM_UNMAP); +} + /* * mm/memory-failure.c */ diff --git a/mm/vmscan.c b/mm/vmscan.c index 283e3f9d652b..38b58a40d25b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7365,6 +7365,28 @@ void __meminit kswapd_stop(int nid) pgdat_kswapd_unlock(pgdat); } +static struct ctl_table vmscan_sysctl_table[] = { + { + .procname = "swappiness", + .data = &vm_swappiness, + .maxlen = sizeof(vm_swappiness), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_TWO_HUNDRED, + }, +#ifdef CONFIG_NUMA + { + .procname = "zone_reclaim_mode", + .data = &node_reclaim_mode, + .maxlen = sizeof(node_reclaim_mode), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + } +#endif +}; + static int __init kswapd_init(void) { int nid; @@ -7372,6 +7394,7 @@ static int __init kswapd_init(void) swap_setup(); for_each_node_state(nid, N_MEMORY) kswapd_run(nid); + register_sysctl_init("vm", vmscan_sysctl_table); return 0; } From patchwork Mon Aug 26 12:04:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777720 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 5730BC5321E for ; Mon, 26 Aug 2024 12:06:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80E316B049F; Mon, 26 Aug 2024 08:06:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BE666B04D7; Mon, 26 Aug 2024 08:06:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59D1B6B04D6; Mon, 26 Aug 2024 08:06:12 -0400 (EDT) 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 298F86B0419 for ; Mon, 26 Aug 2024 08:06:12 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E5C941A0F7B for ; Mon, 26 Aug 2024 12:06:11 +0000 (UTC) X-FDA: 82494268542.16.8DCA6AE Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf14.hostedemail.com (Postfix) with ESMTP id 66B5E100019 for ; Mon, 26 Aug 2024 12:06:09 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.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=1724673884; 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=HrKI7erI4VazFQjhpNNh/lpiowOH/5EUqA52pV6DQaw=; b=aDl33LzEzLMVK/T0BcynaJO09xTGB1kyuqMPYsXjDM/a90TP1mpkUxE39H72Fs570IcFWp vwMwSqGsg8pIyG3EJ9I2/abnRH1rK5QNXMqSZ5au436ZvpywLXuXKhb3mFULn/eBrDjyRp bf+GLG4nMQq/SskprQKShlnHSmCfuGU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673884; a=rsa-sha256; cv=none; b=GjyiKUxE6nCckZdWd5TVL3Zs/7L5YdHK9PFIFIFTJ79App34ZDEYM1NCB1EdEjaTTIOmAA d16RvZ3LSGwCpTAw5e3/Jn6tm1Lw1c+rw9H8CHEoqogqh7P12YabzPDBaC3YquvsHjjQ9v cL1Ccm7gxHOMluqKA8l1wCrXueNDVok= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.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 Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Wsq9r2SqhzyRCP; Mon, 26 Aug 2024 20:05:04 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 7E5691800D0; Mon, 26 Aug 2024 20:05:32 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:30 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 05/15] mm: util: move sysctls into it own files Date: Mon, 26 Aug 2024 20:04:39 +0800 Message-ID: <20240826120449.1666461-6-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 66B5E100019 X-Stat-Signature: dyr1mowbfxqgwdy65ipjn68jtsa33qpj X-HE-Tag: 1724673969-630246 X-HE-Meta: U2FsdGVkX1/MZD0R+EvD3roYV6LNbqoto8Aytj2fE85L9B0PlTYmEpUo3QqsZJOdG9L01F4i11KfN9VB2keo9CJCpN6nLXxThLupR9iBwtyCYuo2mA+633WtIMifrv+7ZPK4k/ikaoA54IIYHJaUuZKtM98FljkCnss8CA3mnLhypHH1XVtPYPx2nJ3SYVCFi/9WtHD6qpCXy/FVU0iq/1IfdfAttSrYnGUIyKHOdOPAjFiYCcDjFfdJQ/+vEN9R22avuW+W4TTJpQdnHKo0w9MltMxeyziSNeu5mxiZIRLKC5nsTDWG5nITTwsqZlZB2ZZKgp+NkirHVfkGwzm5wBhxkkLDPJ/XOEhHCWdrvfW7ewUtOAWwGPRw7FpBeiaxJA+fx57By/STDhmXI/UNi0Agfug7WwJMjGn7s+pG5FeMMblvIaoE/WDYpM0Ea4hpRJCvcCMBfo9BMdY4egk6lN68Qds27qc7qNJZATMOF8Uu9/eAkpw+eQxqISDHB9kS1/L6wkScRCHtOqVde9cfXKyDqtAvqKQKLuOzw9SeOOlU6xUY3gPIsaK4SnEFui+q6uUruZjpJXxAphDs8CKWIJ2mMH3amxEF5Xnhsufs/O1CjnHAnW+xAvuWrI4ZHovz8P08aiR9rsEityWTKAJbAa1DJdrfjOIn4eW/EDlOv3+MCu2LrGpNILVsS+trzhXe5IFMTQp0yr8SHBHUoG1eYgJdpQhFwbA/5Ii7/XaUusxCp52HbrqVzuZPZoMVzoRIz7CrV+/G+3ZC0vraVplpIcuZSN4UIYyniknFILTekREGcvs5yrw58YTgOx5SGpnmy7MwFhAZTCQAjAIEM02HqsB8RZaxxSvuuMnxKRc3CHZYhyNleXWi/IOFnFai+kqGHojgTt6zZuGdQp70AesLOSvcbzMDPpGLNSLekg4ajKm/SY7BrD/vNddsd1MlH2hqYTgMQSdG2McT9bMfxIN cR4UNRaC H1QCYetQh5BMwQ5CPu0R/7c1CQ5LIExrogeMUAmthCpRfXH19NCnlPjc+2803n+aIiWxsFfPYrMdpy7zjVnkzF9B5nHbf07iDDGbCh23D4KGu4CScXPbb0kcXBYcIgeJVkhOT6Fb0MNIpW68C8a5X/thZ4w== 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 its own file, as part of the kernel/sysctl.c cleaning, also removes redundant external variable declarations and function declarations. Signed-off-by: Kaixiong Yu --- 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 ae41092f4328..a04543984a46 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -200,17 +200,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 bcb201ab7a41..e62ef272d140 100644 --- a/include/linux/mman.h +++ b/include/linux/mman.h @@ -58,8 +58,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 184d39944e16..ad3ac6f6c808 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2030,29 +2030,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, @@ -2133,20 +2110,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 2bfae12ade7e..04a677f04ca9 100644 --- a/mm/util.c +++ b/mm/util.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -903,14 +904,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; @@ -925,8 +928,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; @@ -961,8 +964,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; @@ -972,6 +975,54 @@ int overcommit_kbytes_handler(const struct ctl_table *table, int write, void *bu return ret; } +static 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 Mon Aug 26 12:04:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777707 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 3E848C5321D for ; Mon, 26 Aug 2024 12:05:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A7E906B04C1; Mon, 26 Aug 2024 08:05:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A07DC6B04C2; Mon, 26 Aug 2024 08:05:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85BF26B04C3; Mon, 26 Aug 2024 08:05:42 -0400 (EDT) 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 63C2C6B04C1 for ; Mon, 26 Aug 2024 08:05:42 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E6B4BC0F7C for ; Mon, 26 Aug 2024 12:05:41 +0000 (UTC) X-FDA: 82494267282.05.ECF9006 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf15.hostedemail.com (Postfix) with ESMTP id 646CAA0013 for ; Mon, 26 Aug 2024 12:05:39 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.189 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=1724673897; a=rsa-sha256; cv=none; b=TB+OWz1M4T/sGmZQLVAbCkg4BcqHKOsN45dqXQehhO9laWpF/afPtOURrqNxw86bNE8g1Z R3P3CbbGmsvBn81OIUC9q6hC45iIpJ12BtINlGq90/USL3o6HfFQtfqR7rHdlYJtfXd4yQ qih5xqb7XS0JdjmE035Yi+/g9xttmxg= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.189 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=1724673897; 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=IBs3G9e492HLb6ZKCGmkOaQJB1nL0NU2xCOGrniITkY=; b=DuvsLHeO8DeBGGiTEVJX4dqlw/z6asMiYNSUMHVvAUDbSita+4+ELo9YRzfAtlszWxr5ef MxIaFxczfKER9GxVPGxceT+Jm0peEM9qdsp2FmsCVbksbnfmm2xaIxXs1mMFAX5skk9TAP Gb+8ChC1GF/IDJIAbv8wUBbtWKG69v8= Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Wsq4v1T1SzQqgW; Mon, 26 Aug 2024 20:00:47 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id C95D01800A5; Mon, 26 Aug 2024 20:05:34 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:32 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 06/15] mm: mmap: move sysctl into its own file Date: Mon, 26 Aug 2024 20:04:40 +0800 Message-ID: <20240826120449.1666461-7-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Stat-Signature: friscoko5t7bijszf73z7b8kgwcng1fu X-Rspamd-Queue-Id: 646CAA0013 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724673939-490537 X-HE-Meta: U2FsdGVkX1+zERcEPGv6u2TBOVsxHIg66gCIkVKT4RnE9CPi160cRT2jBQNJt0SKmhCf5F+Zwfso5ViT5o1sEoDgYcaNx5YZy3kpRLhR7d8/ezDHpCCiO3Bjraxo1yQr8qgutaqrlN/oh5gJF1ZkoMAUhioVcupYBXsz1gDb7KNfoeNGrH57ng23+4tSZ4Yidtrjg5Tltu+WfmGd5eFGgQQJ9KlOcHCdF+IxsIEc9D7f8EZrTQnGSjsfGlTAiIeI2ZSZ0vLBIrB71V7GiJD4j9hHAI5K8H0MmZjQgB/DFDNYYMFjkvFwTpN0BabKocfKXrj/cTqTqkd1+bfotqIcrKuw6hIkwxRZ3TVcNfVAbERXe/0jlVMpGyJ0rdJlPnv80vv7puh4dMH7yUcufhHO+tnPT0hxR+Lx3/xFPkYso0sGcT2zz5+UpDIZqneHlM7SD9O0+3Gql3bTTV3U+L2+Meaw+bZGF42VRaqlULM8Za/rTZ8Uga+wmMquaRqCquza29M5r7g90HzWnp+9wpB3EsbcAwuIL45tgEznmPZsxaDcK3G2qyRB6U3teG6ETmhIWjZbaT3yszEE7rGySH9uXResvVMrnvAwStU+EQpLykQNO1O2YQiRQAztIAm7IxmvQDE/5vJOkW6XIAEDYNKxbRP/DuSubfvE4llBlskOmKd+5PHVuLV2SwBWLIxMEXI5/qsVd3cO99UcTnSGZXmzli4hWAf0QuxOJsHPZO4nD2bxHAyS8vLjD2oH4HUCrDn7+U0Rxi+qYfnBfIlA8EScEyPEpPhFfdfCHzpo4mSoCvygcV2FSSHJivHC7KjtebV42ejtAgCICsFAmJnUXmmcI9hB0KpEa7XUVZiRzu87m9fyW1pY6kNNSJgZAV5U9W1rlcOIL8bIumUwTcxxvwEZcDpA5u8mZQGbJm5eoPlOZyxR6UbztwDZ7MqkxnbYurUt1+D9Q7sx0bD/7sB23U6 qoCFBiHN oA8wI6ncoFRiLGNEwiIwbeIisqHecXzY4zRnlgZz759vx69dOesrIMwPxpX+6jGXSgZ+a1S/7ZKH+JRHQNGMOvH/bfiehXnC+C6DEy62tZjod3KqJTXvnrtIxvf8v4wpWcWh2AAIbHBrebmksWDu8ZOpBhQ== 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 its own file, as part of the kernel/sysctl.c cleaning, also move the variable declaration from kernel/sysctl.c into mm/mmap.c. Besides, move MAPCOUNT_ELF_CORE_MARGIN and DEFAULT_MAX_MAP_COUNT into mmap.c from mm.h. Signed-off-by: Kaixiong Yu --- include/linux/mm.h | 19 ------------ kernel/sysctl.c | 50 +------------------------------ mm/mmap.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++ mm/util.c | 1 - 4 files changed, 76 insertions(+), 69 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index a04543984a46..9400c92b4522 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -176,25 +176,6 @@ static inline void __mm_zero_struct_page(struct page *page) #define mm_zero_struct_page(pp) ((void)memset((pp), 0, sizeof(struct page))) #endif -/* - * Default maximum number of active map areas, this limits the number of vmas - * per mm struct. Users can overwrite this number by sysctl but there is a - * problem. - * - * When a program's coredump is generated as ELF format, a section is created - * per a vma. In ELF, the number of sections is represented in unsigned short. - * This means the number of sections should be smaller than 65535 at coredump. - * Because the kernel adds some informative sections to a image of program at - * generating coredump, we need some margin. The number of extra sections is - * 1-3 now and depends on arch. We use "5" as safe margin, here. - * - * ELF extended numbering allows more than 65535 sections, so 16-bit bound is - * not a hard limit any more. Although some userspace tools can be surprised by - * that. - */ -#define MAPCOUNT_ELF_CORE_MARGIN (5) -#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN) - extern int sysctl_max_map_count; extern unsigned long sysctl_user_reserve_kbytes; diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ad3ac6f6c808..41d4afc978e6 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 */ /* @@ -2047,16 +2041,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, @@ -2074,17 +2059,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", @@ -2110,28 +2084,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 88524a3768f6..2b37d8fb997f 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -62,6 +62,27 @@ #define arch_mmap_check(addr, len, flags) (0) #endif +/* + * Default maximum number of active map areas, this limits the number of vmas + * per mm struct. Users can overwrite this number by sysctl but there is a + * problem. + * + * When a program's coredump is generated as ELF format, a section is created + * per a vma. In ELF, the number of sections is represented in unsigned short. + * This means the number of sections should be smaller than 65535 at coredump. + * Because the kernel adds some informative sections to a image of program at + * generating coredump, we need some margin. The number of extra sections is + * 1-3 now and depends on arch. We use "5" as safe margin, here. + * + * ELF extended numbering allows more than 65535 sections, so 16-bit bound is + * not a hard limit any more. Although some userspace tools can be surprised by + * that. + */ +#define MAPCOUNT_ELF_CORE_MARGIN (5) +#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN) + +int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; + #ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS const int mmap_rnd_bits_min = CONFIG_ARCH_MMAP_RND_BITS_MIN; int mmap_rnd_bits_max __ro_after_init = CONFIG_ARCH_MMAP_RND_BITS_MAX; @@ -2171,6 +2192,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 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 */ @@ -2180,6 +2252,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 } /* diff --git a/mm/util.c b/mm/util.c index 04a677f04ca9..7f687563b8c7 100644 --- a/mm/util.c +++ b/mm/util.c @@ -906,7 +906,6 @@ EXPORT_SYMBOL(folio_mc_copy); int sysctl_overcommit_memory __read_mostly = OVERCOMMIT_GUESS; 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 */ From patchwork Mon Aug 26 12:04:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777708 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 3E5DEC5472C for ; Mon, 26 Aug 2024 12:05:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 306746B03C6; Mon, 26 Aug 2024 08:05:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2425F6B03C8; Mon, 26 Aug 2024 08:05:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01D2F6B03C3; Mon, 26 Aug 2024 08:05:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C9DF56B03BD for ; Mon, 26 Aug 2024 08:05:43 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 71D3B120FD7 for ; Mon, 26 Aug 2024 12:05:43 +0000 (UTC) X-FDA: 82494267366.29.85DCC00 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf25.hostedemail.com (Postfix) with ESMTP id D78E1A0007 for ; Mon, 26 Aug 2024 12:05:40 +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=1724673857; 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=IVoE1vCPqxjqVVcdugPtOWbDhlwRYouX1AbyQSrHjOI=; b=x/Vbcv+1/YSDZmzGz9N3HJWIy0yTkl0oi9Iu4L6Vl5PNPsV2dng4XsqX5OddeSVGguPmLm 8u7RaCMR3FHbhZZHKkOc8uZpALLYXxiUhWsJiIt1E4cnZeVXwJ9+7QtPUorma1r3ZO8XxM AnyhAqnu5vZVh3KlRCsSuohwAoatMpY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673857; a=rsa-sha256; cv=none; b=sBvKw93cib+D+d6YKISv3QqjVshWiTgjLYoCOvLha2Q54NBRkiDO2YnqEcsu8zbenXV6pB EVOYCr1jL9kigpAOc+h/3ZL0728f4R41cW8RGubpeaCq9sVIdVcEipAiCiInW1Fz6vhVFf QcfwWdDvMBTVocX3cRdY8fbRf1n++fA= 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.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Wsq9b1m3KzyQKg; Mon, 26 Aug 2024 20:04:51 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 1E7631800D0; Mon, 26 Aug 2024 20:05:37 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:34 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 07/15] security: min_addr: move sysctl into its own file Date: Mon, 26 Aug 2024 20:04:41 +0800 Message-ID: <20240826120449.1666461-8-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Queue-Id: D78E1A0007 X-Stat-Signature: 1eoy73a75dorisjxyd3ge4jtar8wpihq X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1724673940-877798 X-HE-Meta: U2FsdGVkX1+w3zGuwLNpa9TlKoHJ3EumPWMH/L8G+dS1taXARIi+RvsUdkmSYUbWwRAqnAzsgd0RM5lUlk9jk50W0DawVMjzTArHq333cTEQjLKEBHh3G7Mu8rQxULJbe4WRB0inIyw+3S2WFcNwBs/WjygzQW6tcuZBtmWTs0bjk+hzCfWsiMBxaDQ7efS0ZOiGHtbJGfNMATmQU41cJEWBGqg6eQdG5r+qTv2ptfhTF/FiPlXm+9K3FC98R8+kA6COwXfwmeOuGZvlzmhjttVvtR7oeX4ETrjcEbVhWUMpQEQSs9cE58R3r6QMa5SgYPzPINOhwpNxd8Fn6HR2v5JT7UdorO1okSNZa5aEywfl3ouBkdQtkZvMxnqSeg4Ou3GsIELSTwJxmkgUO0ijmldMQKqkPqw9u7OJs+hXpHyEN12eJW1fhcG+N9fAg7Siro4UT0VXZgTELd7raddXOcrADxpRvMGVSe+N7FnkxZA3x1jYGgvn1bCNLY04/2fAkLtyvhBxdt57m6/f3qAQWnRgiIpiIpQYwqS/6A9APCFDIz/SrIgCga5PpPsIencnoQ5MqTc+pYrHLGKpcjGAre1Afox5ycrv5PpjV9+7tEQ6x8pBK8zhSGBP4tmfoJ2nz/4yijHxs3d2HpcnzCQ4U3yzvMwRcv20ehOCumEcbebUEld2VnlnfY1vNxckGNKVZ0JHsX0z/nyK8+u2vhcHRQ6y6tT0w0C3jYt/eR00oPunAQ/NGmalWGIrshZPIWEq6Ln/0j3MAl2xMpC8ztZTQVz/sEYMgZhKpQR2FAyq7on6ENBPhO4g1HerydCkmrGwW9zUqxBSf6lyV5NKdCr+Jo/Kl5/u9oR6iAXpoJqLU/JtE7QkVFOsyrEIZXET7PkXVqjXeNT7BXXKFuMgGy1u3MyO5NGGMRD1rQess8SAw8ZZRjo5x17FqOxzgcolwNBpZE5xiSU1B0DgZ2Ek87P c1GjgViB t2OVTe9FIEsnbOtYj217UTBfize5BiQ5pv6dGjFKNho0QTeLz+IXksfCls5MWz5uhomPg0UU4lNFP1N7NHFtWakreg3TiZZ6HEUiXJrDWhJZ/nlcuBWLHr8fuwkdCrjA49ws1Jmy1dh6rn9URuUDdwD5i7Be6jxLwFx3WW/Ws8FJj8g40ueJVQcKB1SMOrS6/xqcS 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 into its own file 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. Signed-off-by: Kaixiong Yu --- 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 41d4afc978e6..0c0bab3dad7d 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2059,15 +2059,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..b2f61649e110 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 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 Mon Aug 26 12:04:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777709 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 0873DC5321E for ; Mon, 26 Aug 2024 12:05:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A315A6B03D5; Mon, 26 Aug 2024 08:05:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96C026B03D6; Mon, 26 Aug 2024 08:05:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C1326B03D8; Mon, 26 Aug 2024 08:05:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 440DF6B03D5 for ; Mon, 26 Aug 2024 08:05:45 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A806AC0F79 for ; Mon, 26 Aug 2024 12:05:44 +0000 (UTC) X-FDA: 82494267408.27.7768909 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf28.hostedemail.com (Postfix) with ESMTP id 4359AC001C for ; Mon, 26 Aug 2024 12:05:41 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.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=1724673847; 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=S1V+Rp15DjldrUPTW94Oc0PG9xvMtXHLdP1+mL4FV3s=; b=p9kC4LgZ/xaylcMn/JiLCC+DPT3FFCDqflb/w8oM3GCz/c8wmR9MtTK9HpL1bFaUOJn5jh 8c8/8K0iJNvLLhOhZ3DcVD0RgFsvMpsNqR+jJ6VuB4FyIN3FE/9HMwdV0ca4m9Tq6rdg5r SVvDEdjJt2roY5M1wzN5KDh1Es0vaeI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673847; a=rsa-sha256; cv=none; b=061K+TEC/F3hCbzR0d9X9s2vqcrX1NIp3htzREGXq5CXSCIMtxN+4XkSN20p1beixx9JTm u9hc6D/hETwEm5b9YgNXNe2yLp3xfXSW249xbOL4pPXz1E9nB1KwrShAiT/FHOcmJocP7u afr29DHxcqExISPTXM/DFw/S5j5Wl5E= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.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.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Wsq9d3wqzzyQKn; Mon, 26 Aug 2024 20:04:53 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 6A46E1404FC; Mon, 26 Aug 2024 20:05:39 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:36 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 08/15] mm: nommu: move sysctl to its own file Date: Mon, 26 Aug 2024 20:04:42 +0800 Message-ID: <20240826120449.1666461-9-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4359AC001C X-Stat-Signature: nthpr3wq69rbfhsrp7n3gsraq8y4fcsd X-Rspam-User: X-HE-Tag: 1724673941-947675 X-HE-Meta: U2FsdGVkX1/MUxjTnq7Xm5iJ1LX1FKpYp0p5HACS0U/63XAEAejhZg5vEf801+AfIUgXi0gYUwDJgpcdAb1d57P/kNqt2VZFwrE9CTLDvlPslue+ZvaCYhkD/UPZLW8Y3ZuDCsEZVhWpqB/BZ/wJIT4ouerg5QD855BT6n/Uygw8KOxWgIsMrTV/716MkqI2QjW1CKBSdIXO17eNDZj/R6und1Q0DuOerbv6iltnVpmqixtluLp4bfumgOqHYZ6y1lPh1vuGRzn0DDoL7oMDoKHu2VOY6WxEqWs3P+guyAcAqhCav4P8L6WBiuM54BvHeZkhFEVNI1HNwecLoxVR/I9gMEsLbKvzTIjvV5sfZZWjsufXEcrd26bEgTf2I2LQXP96HZN0HJtNLhvhaYidZHjMysQvLQwAfci2qXeqocXlVyRoxYgTG9Nt2Q/mHSOLnHbpjPg43GUu3/7sZmCzHsJExzP6/xn0ce/xm2JN0mAC8ULXtDpX8j6UmM2VMVmIbSKImyEmub9qY65LDTx2uzzd8t1Q+IOp88afL3Ke+pXAq2RfTJholdzypefCPYn8UAuZXv0L4ZjGhejLvcQ59xTuKuAfaROZiEBT537VxSJKsY9sNVBTerXtL/z5sWgqwMuL1Q4AdYuEm502UQvkHvGaVN13KVwXaMq7G2Hfb9mN6RsSxL04v/Ij24Mzlhi8Fp0fy4oej7HrJupFbFNJDCbxFCF7T38wFHf84P7CN/i7q9oi5RLY3aR60dCmhVe3bx3cBpu6XXTepBdIX3KW3A4kvDSv6ZWLi2aj2eiK0+6UfaFHfIOZn49Trt+bP+Z51MbqWVG2Bw6KwXZCYar48d70e75bcwuWFw8Ys/1N5tb1Fl4HTp10PqguugFVcaHJwoA7pY3mQSKPTSiAVlzYY6T7JJ51eTqTv3TQgCu/kINf+vOUMoNP3UQGN+FwkShbntM55Cgu3C2fpFCreZ5 qJg6b+Z1 VkIr81aa/o2kYptQOoIDA5axPQxYvHeF/NFOKfo42700xErJJ3O5KIhgQSRgNv73Ka9FKekER/0qfaoNqIUcX33zkVVrzrCwUafccE3NPpRjIQb18jfG1d/u8tugwsDRGWQbO2z5Q2tG71r8T5hGFH5qrHA== 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 into its own file from /kernel/sysctl.c. And remove the useless extern variable declaration from include/linux/mm.h Signed-off-by: Kaixiong Yu --- 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 9400c92b4522..9e37d46fa666 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3972,8 +3972,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_PRINTK void mem_dump_obj(void *object); #else diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 0c0bab3dad7d..d3de31ec74bf 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2041,16 +2041,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 385b0c15add8..983ee961dd67 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 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_syscall_init("vm", nommu_table); } /* From patchwork Mon Aug 26 12:04:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777721 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 46453C5321D for ; Mon, 26 Aug 2024 12:06:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E40A6B04D6; Mon, 26 Aug 2024 08:06:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F127B6B04D8; Mon, 26 Aug 2024 08:06:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D15586B04D9; Mon, 26 Aug 2024 08:06:12 -0400 (EDT) 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 AD3686B04D6 for ; Mon, 26 Aug 2024 08:06:12 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 609F2140F64 for ; Mon, 26 Aug 2024 12:06:12 +0000 (UTC) X-FDA: 82494268584.28.DDE52C8 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf02.hostedemail.com (Postfix) with ESMTP id EFB7C80024 for ; Mon, 26 Aug 2024 12:06:09 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.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=1724673927; a=rsa-sha256; cv=none; b=SZwt03MsqfJIz8NJaPhoSewO3+zEnzp7hG94wqnP3A/y538vSEZUms6DM2kbd2rKqen/Cz EvJ8EoKIxaFNuJHqwLB6dYDSnZQnwazgv90Zl78Nl0NblP8Hp3u3UmfoPiX9QaoG09Ozw5 KjjBip4dSrUFiShrmTWt/ArDKLc4ZKE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.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=1724673927; 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=4Z2oqMlL/Xp9UiwqHQYcsKaUzT4D+8dGm+Fnv6938lM=; b=2FyeZ+y1wh5AxSMmLeOzysHv54yExPNinYPKFOT5uIa97kAZSymn7cGbrWrdIIxRaTOYow PL7cxCo1oeeiZgmYevuqLJ4NLYtJdbPem+k99zpwWLDtsH+5XX7TAUrGMR2BZLT+4MKAPJ BqR9P6Cp1x51cHwyLS+1oKmbxQWtCDE= Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WsqB146phzyR5w; Mon, 26 Aug 2024 20:05:13 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id B6D8A1800A5; Mon, 26 Aug 2024 20:05:41 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:39 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 09/15] fs: fs-writeback: move sysctl to its own file Date: Mon, 26 Aug 2024 20:04:43 +0800 Message-ID: <20240826120449.1666461-10-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Stat-Signature: p5fwmz8i6bee475q7yypusdwgtuxb7y8 X-Rspamd-Queue-Id: EFB7C80024 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724673969-422896 X-HE-Meta: U2FsdGVkX1+2qEgDzmFkzvoTzZ7jZwziDw4han0qec6GUMXEnLvybSSFYH1uple1luOXdpT8DqLn2N0xP2DUhajPiIcHNP/xlVAvQwVo8ELYhfctA9a9FliKBpZhmi3P0gNcA6fi98MWJ2G8Cx3/uOgWsEn8XFxGKTDl6nX6mQCRzjAT2lEgYKVolFU6Q+RnCcWFLgX4lPdJMDLk/4r2ipUYshk+YLNBv6vNg/XLJXAI/XG490ylVmATW7Mh/e/2X2eaFI1/aqnGZ6JkaArF106cQWxe9/jp76Ps0BaDEwNF+/JfhbTDxQI2/lDSHuq6NdqSArYDTw1wKTRxo9bh6sN8D5UK4us0nAVGyZP7vakx++J6AyAvfzMLWKYGdmJHbQgIhap4mbJIT4bHreFFvNPZfeJQa8cAOs8nYJVxesUXgtJVraRcdutwDa88ooug82+ydUAfilg2tZsf2iLHXiqWVQqCpBOP/VX5evXYzUTobdkJg7X3FgED4SqFHYdfrTVmLZ6Q6BRzaEsX6MCW5vKqh2NrM3Sln2jGJMQqqonqOA/ZUzQhRIPeVG2lfwcBqiVwfuBNtB7Ug0g2X6S9ChI902kPRfkid5bGBmcpsiK5amIcH53PAkCn65qSL9yN3boxGFF2IPQRQqWG31KmLvVnuBHcX2FveoUSiuhZ77O9apiSXl2e6LU8UvRZcagJvXSXVfTsjUkE0f5cdEdFJzfnRbsJaoZ+nBfW1SZawlM0gfOscw1GwFCoROXsM2EebChjdxtueHY4h8tgUYk0PFBDjRFV0nUEIatfy4TZ9QkclIDUg1wMMDku+YvS6TanBZlBvQDmiShBTRnrraG+QheLVxxR+YmRBcKQeVX+UYJsMGMM0cGAcD72dEpr5mwSSXdYDByPffNEdAb9KDQkTVJ2S7hPUKDPs0kFrdfRJSpyv+EX4yQfX3zvJqG2vUG/5pPHvNIKWRtSHZj+5vw aC1lZwFG SysC5I3H5H/Ylk5H8CuyapVxd+aAN6zy7EwDOtlaOHekioUqAb6hOHgxyV8E9ajD+Es7Y0pndkSww9xzVKIyhZGt5qOpLfilkGvBcvN1cCvWfekkN+phyVSuxHRfp2mSpQC+xqyGzLj8371CfNJG4YYm0AQ== 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 into its own file 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 --- fs/fs-writeback.c | 28 ++++++++++++++++++++-------- include/linux/writeback.h | 4 ---- kernel/sysctl.c | 8 -------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 1a5006329f6f..71ff73552323 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2400,14 +2400,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; @@ -2418,6 +2411,25 @@ int dirtytime_interval_handler(const struct ctl_table *table, int write, return ret; } +static 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 21dac644d325..22bc047ed91e 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -351,12 +351,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 d3de31ec74bf..373e018b950c 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2024,14 +2024,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 Mon Aug 26 12:04:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777718 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 D29FBC5321E for ; Mon, 26 Aug 2024 12:06:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6355F6B009D; Mon, 26 Aug 2024 08:06:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32AFE6B00D1; Mon, 26 Aug 2024 08:06:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BCAB6B0098; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) 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 B45826B04D3 for ; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 70FA4410A5 for ; Mon, 26 Aug 2024 12:06:03 +0000 (UTC) X-FDA: 82494268206.19.8C4618A Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf21.hostedemail.com (Postfix) with ESMTP id 0D35A1C0018 for ; Mon, 26 Aug 2024 12:06:00 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.35 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=1724673848; 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=sOkIIcnEqEzuEUJOqXnIARzH0REOuidbOyffr1zGOCU=; b=ErYne5mAMit/N5CcUMjonJ9KSSAWEcMG7zXKBAA7TrWaAg9iduJiMq0XGxybRyWy1CHH1C /faL9CsdFc+/CtGgLgZGG27WvUxz1BenP/4Yngawye+3+r3Ni6mIFjfkGRzS7BZZWtiq9D nM53q1Sqyi+kesJOX+rJpzEe5UJHFpU= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.35 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=1724673848; a=rsa-sha256; cv=none; b=0kSepxXzPFhOvm1S7VVovQrNtlbjq2JK6ymuNL/NrBkIHMto56p+XlLKYBMpTztlL8H5qm whseIlKhLL0MZXZtaKD7eVWA3a6j0UeVQHzgWQ//6PErqChz/tPTt1Fz8KpN46aLMn6xbB eIXp3nTsCbI5RVCX3LccoQg+fUSsVYE= Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4WsqBQ4qLNz1S913; Mon, 26 Aug 2024 20:05:34 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 0E97B1A0188; Mon, 26 Aug 2024 20:05:44 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:41 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 10/15] fs: drop_caches: move sysctl to its own file Date: Mon, 26 Aug 2024 20:04:44 +0800 Message-ID: <20240826120449.1666461-11-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0D35A1C0018 X-Stat-Signature: bdc7oaps43zw5ft78jzkq89hn4tkxigi X-Rspam-User: X-HE-Tag: 1724673960-827326 X-HE-Meta: U2FsdGVkX18mMBLsk7tYU4CpxPt1yGsJzF5ymFMBJi/zmvadETcJ9taW4DmaOqQLkGMNRsdwiRimg8lH17Z/g5Ym0aCHlWP1c3+yiqQ2WWMeANuokAov9XgJBRdQvYsPyfZjQBZ7gBZ+m6ZzWjAyeuiU6aKyghw9cP7c5C4qe9x25DQxHVK8yJN0kN5CAn0G3EJM7Lu3+4Yf2dCjexQxaFZtfksoOxgYBT9O9EyzU4JkzfH+HhTIfyLtF8+yUff/LJwO9AvXDp+iOKbhbFz+V6D2/hHZc2B0HM88YKiCBJj84/MZp3pKC06Se7kQ8NcGWOyfoZXborvgMU/OQN0P34FTwok7unE8u4Lu52/RE8f3Ggjn0vSGj/zxXuIL0xi3K+UGCDH7MIdyjO4xNeHOQ/ioZuXUHy++RGRbi2DpPmeuax2qXVdrVnF2RXseOox8VGioh0QOjUxLn8mZTyGzTQ7RCCYFNcm8tsIaALYX+vbbdTFTH0IpzDq6n6BEQSnNgxLWUn1BVtDSGvYeDIM2Or9l+OR10L5lJf2zhwF8ZC3OZ/B5ZKW3YvsNl3gFeSfSjOXkco3x3kXdYbxpOHjAHKsgHIMcFD9p9B/XPNoa/ZGKYCg3n5vDBOAbRdFQK09GZaR7JMIWfHTEk7X0JGRHc5xZ4l02uvGxcwyXUJhZCu/7AwKth7gO9K+CkOWREjedtW/SrilQDf3gir6cHs/gq2VHuAHwb//if6wBvbO1Bp3S4fhQIrT11JvLswaYGKslVgbVGPlj6fQ8dTG5L9gO/3AqjBHST2YFxD0L6VFd8vQVeE+5iigsuOsH8KIAupRl+vHRzI8wlnTRoNarG5e6BbhRZ3Z8Z9J27N3uSV9vjPJ+VywUd2prvVy4UBSxb8RCVloYEjZz/pl/Rl9W06X1BJQ5BTUl/ndvvuZM6hUdPljalgzDDQHG4lu/Bcz3iptvYY7VqxtvyNtnRPSKWdD CQTZvvjl T4n+UNov4l//CP6cbk68WenkKesACP1bov1UhveubKs4ZoPECsCr2M0zvSguoVLdlwdKu3K1t254tqas3jS+Yqz4fUoOGFjjPlGf0uABt6ybu/1cz4sXGtqRiRAMLkfgmwuuyEsnF3lfRDgLSrqzU+t5BghSNHMATZn3RF5GC2lTZC5uOIRWmYiu3tysNv2mfva09 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 into its own file from /kernel/sysctl.c. And remove the useless extern variable declaration from include/linux/mm.h Signed-off-by: Kaixiong Yu --- 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..f2551ace800f 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 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 9e37d46fa666..a297a298542c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3693,12 +3693,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 373e018b950c..d638a1bac9af 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2024,15 +2024,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 Mon Aug 26 12:04:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777717 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 D5B59C5472C for ; Mon, 26 Aug 2024 12:06:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A4BA6B0098; Mon, 26 Aug 2024 08:06:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 158A46B009D; Mon, 26 Aug 2024 08:06:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBECE6B04CF; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) 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 883BC6B04CE for ; Mon, 26 Aug 2024 08:06:03 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 406C51C4CF5 for ; Mon, 26 Aug 2024 12:06:03 +0000 (UTC) X-FDA: 82494268206.21.A4729E4 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf27.hostedemail.com (Postfix) with ESMTP id F303240007 for ; Mon, 26 Aug 2024 12:06:00 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.35 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=1724673847; 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=1Y7ykhkiA8xxUv/SVfpu48hty0VFdDmD5CTawvTctOc=; b=qQyB0ab2FEbMHjt4l+TfDpyYcoYtp9MX4LDmkJ+ojjYbSKlzaR0o0wQxU1NHgu/enuCvo3 +7XJduy0V9X4x7IIvrcSIRcKtJNxYAsIbvddmhE8QPV9cg8Dh65Z01Ci/glILeSy7ufD2j ANEHRKipI+LKec/BFnGez8VopMftBqM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.35 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=1724673847; a=rsa-sha256; cv=none; b=mqaxI/OwojHS6hbdylrG+y/GJCQuheXcKlCLynne36ax7yJqsgAH2oclHVsTmdS6RZd23O /CfdE1d1FNqwdlIAf9nPIf4dUI1gi/kiA5m1ubjw9Xvf3j62TztABQ5upEJ9sPe7gGRXjP uy78ACn7cJbtTjoirTJpXikWz+JD2iM= Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4WsqBS6x1zz1S916; Mon, 26 Aug 2024 20:05:36 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 5703714022F; Mon, 26 Aug 2024 20:05: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; Mon, 26 Aug 2024 20:05:43 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 11/15] sunrpc: use vfs_pressure_ratio() helper Date: Mon, 26 Aug 2024 20:04:45 +0800 Message-ID: <20240826120449.1666461-12-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: F303240007 X-Stat-Signature: j8wbgyy7ktqdwu8nntfkigtr3e4xzigi X-Rspam-User: X-HE-Tag: 1724673960-273640 X-HE-Meta: U2FsdGVkX19veI1PLPPgahcC46dVHn0jREhn8CRyuhensMM2dZ8X/s3oAUueKsMsFLrK6YkIDZprgCTvyAaSOQcLZQ+pIO8ccEDEQ6gWcwts126fERI3VPT0KKUb+JZ2aj6ONry+gWmVE2G0H/HvDUgNVAfmXhuagEgBP+ej3J0tKgZiJBeH6TqcLTj1Zjb5T1rHADJ3CVgHS4yrrx09v0KGtqBNEOskKc9BH6DLCLaym2bOo9yWYGmX5BbsgrVmQt4UjyG8lPA5/S6Qick1mz5nSByAUluwg/IwW7WSJ61l14X3tCK6pCWa9gDZ3kqu/4hHd8qw+F1WOoQZ85+Djn2SvM+zjIFmrEyotyvWH5GD+0lbI2K+s0xnHPlBZeRt0rD4x9vww9mN0AajbiKmh/13UMvJX8dI9VdEBKx4NDI8F80YL+JwsDTgSoHR+nDszHskIPZ25BC8glttzjTkI28t+3wV9Bd3dDo6Dm7bTKkwtiT5cyndGmYJKe0XZDyk0c5eDk5BTRPT7pdZQgw7hcKbtLWUsxZhSxYcx6dz9Vn4Qyo6KcE96lctsld6aX49URBn2ZZmIH4iRL9+YmB0ii5rHLrwIrJwQ2gFVP65htC2fzhsYaLkd0jcGZznUvmk3T+W96yH+Uqln/REd6alf+ZtKc6OE3XwBI4EABV2o0u2Xya9Iq5hmpgyyIIUhbB5V+VPmdUW5BTwAUVlnN9uJkUCW0LbbVZFrKo+/YbRRNLZneTtyXm2n9lMKQGGbBJl+RoE27oC+kR0LY6pVjH3Fb3w1K8cOvUWGR0Hcq2UcypzonSHlElS+qxf4TIEkDCNJOxg/A3z0u/vgVtdGLfwQwjX2sSIG8JrqP8X02LSV8fdoyAy77uyEit/jLG6YNh14hoKqJWlM8Wz4XDxdCRQjqUQoei0t8S6PhoqHV3beUdPvafwmud3zLq2HKjZc5X7ZM99pvyV4hzpCEyMp8a dMRM/g3H A9G4K+FHp05eRs43YA+uAvD8BXulWKDxy+H3GJypiuZwuueagO0uciiym33ez8Xc+XLcemOTofOViv0QNJItDunqKfrE7UPUXFqSPizN0cyVIId+ox/OS8rRtQXautYLe6H8l/KlPZj1aliQbgv/LCvKtD7NcjPG9A44ku9xQoyR5XHM+pdHTCYPbQavJeNtLVMEE 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: Use vfs_pressure_ratio() to simplify code. Signed-off-by: Kaixiong Yu --- 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..3d2b51d7e934 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 vfs_pressure_ratio(number_cred_unused); } static void From patchwork Mon Aug 26 12:04:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777712 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 877F6C5321E for ; Mon, 26 Aug 2024 12:06:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A805E6B04C9; Mon, 26 Aug 2024 08:06:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A09A16B04CB; Mon, 26 Aug 2024 08:06:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E77A6B04CC; Mon, 26 Aug 2024 08:06:00 -0400 (EDT) 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 5B40D6B04C9 for ; Mon, 26 Aug 2024 08:06:00 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 134E3120FF3 for ; Mon, 26 Aug 2024 12:06:00 +0000 (UTC) X-FDA: 82494268080.13.3C934F9 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf04.hostedemail.com (Postfix) with ESMTP id A02DA40014 for ; Mon, 26 Aug 2024 12:05:56 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.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=1724673862; 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=pN4AFoIHeIFRa/0u/GT3udNYVs6mCB8eMlNQ1KKGTJU=; b=MbCOYcV/AstCd0XFpsaUqDz0HyM/ZOBzWAtWH/NQnAHVZJgGClkmcSTreL1F+jtDebJtR0 19EhEf/CrmP1iiz7nb3CMhB9T3Ikj+c+7S5F1BHSxw/sH90kfMG9a40bMaUCqY+DEz7kqZ v11Eaa1OTZef8MRvHX9JVwQgwo5y3uA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673862; a=rsa-sha256; cv=none; b=DyO+VBKEW31rIi8VPr/IDR+7fzFsd/2+HymWFwghsYMEz2Mnh5hzFHlOIaC1XOVOEZjHqw 5W059xsaUaKLAilQDv0DY7ppqvpniWuqxqTiSoCc5cyc/e8W63hFxe8Quzq/FA+znlafXW MXvdX+VSAl1/EyE7Ei3bAH6tueLvqI0= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WsqBW6Kndz2Cnfm; Mon, 26 Aug 2024 20:05:39 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id A83AD1A0188; Mon, 26 Aug 2024 20:05:48 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:46 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 12/15] fs: dcache: move the sysctl into its own file Date: Mon, 26 Aug 2024 20:04:46 +0800 Message-ID: <20240826120449.1666461-13-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A02DA40014 X-Stat-Signature: e8twmo9jthz3dpr7ifcn6bo4bebt94nm X-Rspam-User: X-HE-Tag: 1724673956-140370 X-HE-Meta: U2FsdGVkX18gOVdhIYIM5/rGfbLbf+odTpb5HbOwbSPiIOeWsZ9z84ZJWdKGK2KI4TaL/3qlq/sN+HvfuQiIq/WKqKCVaxmz7bzkzwWcGPpzZILHXu2+vbwueFaJqgHM1D2KIWEiVjnAe0TmeJHgMMxkFqJfHXEavZqu8C+ERpNYRW5Z3ysxOYmEJtLoqjxhR58vjJKvtLADLMy/dD3L/dZ/i7bMBmCQNDQZsNpSBYtFvm7/dqP3aYmvB79NVhj1bGXi2yZ0y7hsluffCT4qUTKrxG6sQUQzTTO7i+HLD9b4F6RBBm5Qfvb4j36Q1rRAKTiMnvD0r23BJ6KPZFxDClhs8pXh2y+kF2785EyEcut2josNsVO1XvbLHGDU3KFOMQcO5YRMC/aqT945GdUo7YTxgNcnNdhhH6qmiiCM8HOb6BStPkDj1SVrsrvu27N1IG02wjXCokFGWrHtI6hKhSApP8y2MNLW0Y/AaxPHPaPpsauwET36S9XS2UXZKxuzeCXiWsjoQRWShW1Ts+BCxLI8DyX6HUyskZdkpTdqfADawvq5qqgaIXWxNa6SeatFQKuTVd9hIT5eZ2LSBIPnBJ96cMYSSiW7PSktKREgPYtofEMeiTiFDP/IQGhlXCEQQe67Q7uKKW0r8K19xMSEPkqAfQ3jQXcUimNrQJn7vqh4yG1jdzKGXnxvbD4QyxaJjQXudfYyf/VZkGmb0wmyQEhbEAimdX+hJzKk0JHagjtVmOQnpg7sqV+14Gv4z08Kf627JB9FM7o7G2mkqyUAnMNSEo7BgzXJf/XRyp04LNJ1EzXFRe3at11rt7GZwywP8APSy46FTF/ErGL42nceZT4RZ7x+/yAtNT+agUPtLvMGPqLnVivFjEojPaLG8uuRpd8dEqhynJ1pfkczkdL6t9/4FS8+6k9mcGt+5tvgznCfzXpGO4Vr1KTYaN3nR3JypIOMNogdEI7AuAxovI0 w+Yw1igH j2DsKQYxVOCxMfYXgFjaGHmWcGLoYAuaTVZbOepE4dsMhHlEtYx2ECpls2StEmQYcKPDIIh0HSmJQPdL2XUawlTYHCHMnEF3Q60JvrumpCjBLcwegPnVxIqQsD3NYrnzYYZWeuuRVv6HEGOnnSxH2nDZLnvrIXON9s7yG4TVCY7DLr3TjGm4DIaslg8AHVADjfTlczmiClmgBeO7JNmRJmFsvR+kTV8xyCYwESMu0kFqPdD+tM3KhRLvintiLp0iJgE/zSuDE5Kw1I/LAFp+ADWbBJQ== 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 its own file from kernel/sysctl.c. As a part of fs/dcache.c cleaning, sysctl_vfs_cache_pressure is changed to a static variable, and export vfs_pressure_ratio with EXPORT_SYMBOL_GPL to be used by other files. And move the unneeded include(linux/dcache.h). Signed-off-by: Kaixiong Yu Reviewed-by: Jan Kara Reviewed-by: Christian Brauner --- 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 1af75fa68638..8717d5026cda 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); @@ -196,8 +201,20 @@ static struct ctl_table fs_dcache_sysctls[] = { }, }; +static 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 d638a1bac9af..6f03fc749794 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -2024,14 +2023,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 Mon Aug 26 12:04:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777710 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 C3FA3C5321E for ; Mon, 26 Aug 2024 12:05:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C44B6B0145; Mon, 26 Aug 2024 08:05:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54D266B014C; Mon, 26 Aug 2024 08:05:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3ED3E6B040A; Mon, 26 Aug 2024 08:05:58 -0400 (EDT) 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 1DD576B0145 for ; Mon, 26 Aug 2024 08:05:58 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9ED4EC0FC6 for ; Mon, 26 Aug 2024 12:05:57 +0000 (UTC) X-FDA: 82494267954.07.C06B718 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf01.hostedemail.com (Postfix) with ESMTP id 2C80440020 for ; Mon, 26 Aug 2024 12:05:54 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.189 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=1724673936; 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=6AxgHKGi1srXNKz9QnA8kiIxDib+N0ydNrButpCH8Gc=; b=6PvKmLQTBnE6trSC1Vgwdpomi6yz8f4jFgx2CiE8VtJfm3F+Hlo8Axx4eaU8kJ2KUE4hYG vD/gJ0mf+Pq/s7uZgm3rkly3akEGi6n2NnOAEvsGqFRBZ7FvVyuHvNtPH074kwODha73Hs Z0MYsjek5//8Fyj2bqJ+qzJApuutLNk= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.189 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=1724673936; a=rsa-sha256; cv=none; b=dPZGRsAtWXQ3qVGKs4VBoZmxjBor9kI3qEJM8/Re6QRk1p29ABKlPF/L/y3tL/+5uc2KAT iwiZS1yjY1li12Np8+oIAkJAENkliU/fSP8Ear6NsGo9cZHrChOoWMlrsuNmq/vhnov0MB Iua9hVyq+/s1xRMQsrDiNTm0ahtXA9M= Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Wsq5C2dFqzQqhb; Mon, 26 Aug 2024 20:01:03 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id F1B301800D0; Mon, 26 Aug 2024 20:05: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; Mon, 26 Aug 2024 20:05:48 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 13/15] x86: vdso: move the sysctl into its own file Date: Mon, 26 Aug 2024 20:04:47 +0800 Message-ID: <20240826120449.1666461-14-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspam-User: X-Stat-Signature: ohzpxyk4xt9qqa8acu184paxqrxyrzys X-Rspamd-Queue-Id: 2C80440020 X-Rspamd-Server: rspam11 X-HE-Tag: 1724673954-756657 X-HE-Meta: U2FsdGVkX1/c04uWJg1iqIP9zT4o/csXqbuSaZ6ySQNwk5HzFAxA9N8V46+dhaxiry8+60Je2FD/WeXzFHYBuJyfV9aaDBY98WOQt2stP1vUzGGZZk3NaNrZG4F97dUcdJ7IsFmrJRUsykG87eoaRpYvq/jOAl57VEj9gZDRvAiawYYeGcU0SgdAw4j4XKkQAA98XPNs9f7I9z0T2c8a5DkULtLGJll7OUs+3bsulp1C6FGw7z8vxIV4YteWPYMw5pxZSGxN9M6LwGlXkJtbrPmAOZ9jyHV7xI3eaJHBFhl2hTlnYlFx2uB3rDrJt6wC/HYbyxb+zT60ofLXRAjkZOhFI3skg5spLgJCm4bcHUNOA6692l6LkesDVwY6yEivpZ6f3bcXFu5ne/bsHRnvIaBaW/guIcjnZonoW8r+6/BL5UfXbaB36ZnLIduki15nWCC79TrHQ56oQYczYaziOgBOsdW2WPqEiy2gG5WypmYo6oxxtc6IoyGwBEWgPb1GdvJbI8ybMYs87xpCovgshpV1ubEiR9acxXncw++rdsKwKMIWnrZRUMvorjVV9Kj0kyF+Lb1pqJn3DTk5YThfh0eGJd+rGjlKAca4/lLjuzzHVcJgZsJI1H51Kb/yZuTKhXlHDPUEEgfJtNDyX2OGDp4dVe1c+NYtezo/80xx7HrowAcrMU1F9lpkk6jMy4x9VfAtPkpKIo19bBwkZ3XuPIVe3p9Jp/z+lpaCQj39BlOV/VFgQkTciPYAOdcm7GfaIPb1pU3oxan2heSJouj0bkbQcNqcO5XqKQ7mMto7Yq6OC4JWeR6cDwNL/5elygaWeWhZEg/SVj/UN+GFTZfnD9I/Ok9g94fef3C+lhz57Q/qTRgQtpWzwg1VbhWVyhD4fXR/QBSYa8wc4INBufXBne+Rlq67bYRbaD9eej2/6iEi8VEq8EQueunqlNE42VqlJIARZEiTOZmlPb+2NWW GWCF8CEq +zyVlv88zcczR4ywafw45mAcGM6e+Wl8bA26ihpW8aP2/Ab53JOSXJ1iSI4P8zysF6/cFbnAjCJRzYWHbVYOEtJuSie1hbDlL6rulKHJf/glQA/FtVO2qLpy38YzJs1MqmavK4hxb0noLE6dd2051rRfCsQ== 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 --- 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..5a6886a006ab 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 struct ctl_table vdso_table[] = { { +#ifdef CONFIG_X86_64 .procname = "vsyscall32", +#elif (defined(CONFIG_X86_32) && !defined(CONFIG_UML)) + .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); +#elif (defined(CONFIG_X86_32) && !defined(CONFIG_UML)) + 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 6f03fc749794..24617be93119 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2023,17 +2023,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 Mon Aug 26 12:04:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777711 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 3D15DC5321D for ; Mon, 26 Aug 2024 12:06:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA6F46B04C8; Mon, 26 Aug 2024 08:05:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 944586B04CB; Mon, 26 Aug 2024 08:05:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7219F6B04C9; Mon, 26 Aug 2024 08:05:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 49C646B0440 for ; Mon, 26 Aug 2024 08:05:59 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E15A2140FF5 for ; Mon, 26 Aug 2024 12:05:58 +0000 (UTC) X-FDA: 82494267996.29.1FCBE9A Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf10.hostedemail.com (Postfix) with ESMTP id 78D12C0024 for ; Mon, 26 Aug 2024 12:05:56 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.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=1724673914; 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=mt2OG3fTiirxAORpKav93jptk/RGz+qWfIwPdmxn2xo=; b=InYzy1HIxrIPb06mFFm4ugMjVAXQL3EKmfOw25k8+7LoQfyK6g+T+sQJj6fH7YAVNNB1YP MD5TAvMloyuLuXmxh67hgir9B6JSgdyGxAdu43nn93FZMiPyTdT1PIL7ZADPKyG4aunPh+ TGPaFw95qvRF/x8jYGK1Ql5CibKkApY= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; spf=pass (imf10.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=1724673914; a=rsa-sha256; cv=none; b=lL5pmH/Bma6nRKNHGvIYXU7LehZ4W6WOCJtzbd/1iJ7vv6rBox6hYMQi/luFW5xmGFXFzX 2WIpNk+Qpo5ew/pqusJ/th3RZ+YDJxfbhBa//ZlMutipGFf5PxC2jqvAPWfr4eOaZnxlmf BJnLOACx0M1U6VCo1yPL6xZC85YYscU= Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Wsq9v2t7YzyQK8; Mon, 26 Aug 2024 20:05:07 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 4528C1401F0; Mon, 26 Aug 2024 20:05: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; Mon, 26 Aug 2024 20:05:50 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 14/15] sh: vdso: move the sysctl into its own file Date: Mon, 26 Aug 2024 20:04:48 +0800 Message-ID: <20240826120449.1666461-15-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 78D12C0024 X-Stat-Signature: ot89o1sb984yc36ix6dg8putcs4gdtex X-HE-Tag: 1724673956-746252 X-HE-Meta: U2FsdGVkX18ECRrjnxL966KNBN3BuR8Mr07XzpeNpe4O6a2NiI2OeGx6X2y8OETdo40oUmi9hOUivMWfI3a1+dnH1TNDHhK8nzqkhBTqEGY9Bh5UmKsfPeeUwcH/M3bSIXSL3DYVXiLDpa2qBkpOyHZl6Am3OX+XSZsAYsoBzh2gEDuMBIBXQf/NJQDbWF0kr/YnmKkh14FuucJxXYPkNgc9iHyvFod7v9qIw5UItpBpkBEoVWZhAGWwlrk3Qg3DMLYrOXoT3EVdV/x/ClEBYKt6XYZXd0Dr42O5s9NrM/RFrj8WV7YWIf0XlZXxRjyB1NXbunszxkeuML2/+VQHf6ujq1xH8SlAAVjjfYivIU7oIm7ZcYe/XJPzTRtGWNuw40yQUpnEiUnY3AFzk4w1RNiHIiraw2SzRbzTgLZKqTmmyKJ/fgQyx+ljrR3Yn2m95kW+CZnuhYroRLfS8obndgFLf+xvNyk1wHjCrWbSMbGZ7QAy9Fimxng2JrhZ7eDJYDOJ+aexY29oCN+juvgUYt62jpSveacBGdtc3pLZAOiJAiWGKNNtWWa+O7v7tvnXeAQ3aroUbujO5LSQtVNh1LPMmpvJ9u3LYAjWxXulQ2dYhnefxFoKXqF6i5ns2ZlQ6wW0gwIYct8hpUkgKYVSFzmAcUrcRfN5/OK0mZbZH+BB++jPSp4erefb9swtSSUeoJjNnqbXYe6PTRy6GAJo4Hi95kwlVJ/XPcF9Tpa1ef2QvFV2UL2SCTlNiTVDn7qg6ALop1k9fXyi3EyNNpBAAG5QbmbD5DWTuvRaJOsUsAgPLzQeljKdz+LJZc7MLgWImAZXW9mxycbsntEHPcquygmiLs+Tm6cDHWov5JtZRixn+BX/KY+rrjG4qapbCvKZtJ/Lib4thl25Gcn8FYKC9xkZUSwH4ulfbytXb6D+MTWWh9R8JuC98N3b3eTutSEWlqniDaxIbVemgCFnx5Y H3pDglVr nfY/5x6FbyAXBzeFalJesQ2coykDQdgv9HAeALqLHfMTKO7kOgBOtDDegIX9weEaxWwW4XKRn0B4Y58LX/lbZYR4pvnaG+9DWCLC7OR6TlUN9GQHfSfP8RB53oJiDc4CTFF33da9Lc+nRaDQqRlBTdXSmfizI/gx2gTXml/cyP/aKnB4Y6vy9p8aVEQ== 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. After this patch is applied, all sysctls of vm_table would be moved. So, delete vm_table. Signed-off-by: Kaixiong Yu --- arch/sh/kernel/vsyscall/vsyscall.c | 14 ++++++++++++++ kernel/sysctl.c | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c index add35c51e017..43bc3715e38c 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 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. @@ -55,6 +67,8 @@ int __init vsyscall_init(void) &vsyscall_trapa_start, &vsyscall_trapa_end - &vsyscall_trapa_start); + register_sysctl_init("vm", vdso_table); + return 0; } diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 24617be93119..f04da9f3abc6 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2022,23 +2022,9 @@ 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 -}; - int __init sysctl_init_bases(void) { register_sysctl_init("kernel", kern_table); - register_sysctl_init("vm", vm_table); return 0; } From patchwork Mon Aug 26 12:04:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777713 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 73A86C5321D for ; Mon, 26 Aug 2024 12:06:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D7056B04CB; Mon, 26 Aug 2024 08:06:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65F3F6B04CC; Mon, 26 Aug 2024 08:06:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48AD26B04CD; Mon, 26 Aug 2024 08:06:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2D0DB6B04CB for ; Mon, 26 Aug 2024 08:06:01 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DF4BA1C4DD6 for ; Mon, 26 Aug 2024 12:06:00 +0000 (UTC) X-FDA: 82494268080.22.8290383 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf27.hostedemail.com (Postfix) with ESMTP id 90D4240007 for ; Mon, 26 Aug 2024 12:05:58 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673915; a=rsa-sha256; cv=none; b=2x8+wOCypvBScGHGQO2pnJQzuF6uNcZtP5Az0tSuNU5f4QLNliYpF8Lp21VU2RmlYN/DRl cXeOzgBoaomVEEnGxeTx5EppqXxLT62wZOg9Ba9CR+AlBwBdZI0V0ZuLEkkZgo6L/9720Z 3RJ5yQolA5CJuD+QiAPnU7od114Fm1E= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724673915; 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=hp0HVs1IlBzhKvAE3qW+Quagbb8xQlk1LmAwAorS2a0=; b=wL77GfrgQTwRjKWomFYo6McPxE3rTPMZ0/tNC3SY1c++Wn6Q/TE/Jbn8nyqqNTLiUoH8qi qWDF9nRXHlpeonL2JmbP/GHY36wC1C2XsKaQdPemb+SnCoioUl5taeowzkZ9EoU9O28Mn7 TzEqc9MNOMgknakfcOuZdmZzle3EYD0= Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Wsq9y0730z13Kmh; Mon, 26 Aug 2024 20:05:10 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 94F22180101; Mon, 26 Aug 2024 20:05:55 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:53 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 15/15] sysctl: remove unneeded include Date: Mon, 26 Aug 2024 20:04:49 +0800 Message-ID: <20240826120449.1666461-16-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Stat-Signature: csk9xtbfab1jxfdukqhf5a83zbaw3wsf X-Rspamd-Queue-Id: 90D4240007 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724673958-407198 X-HE-Meta: U2FsdGVkX1/8rZOc9t8IGgaa9AqyuXOf/GFKrBkLheyZQuwhOge80Bs25WExLl2pgIXVJ17OyKb50VfvVMEBG3wAZrDOOoqvn3QplydEV1B7ClAGhS8tVuzyVovadSgepUlFgpbPzF/00YqaEnpTIfgCxiLJh/7GIB+E/9PPmuE7C5B2ea1Y6LowM7NY9/+TLpC8S/POYGPFNRX03jCj6aFREH/2WCsBKLwDi/c+vqW9WL9/YIxpjjsMUralTSHs8owhZWqk8mm81M6uQ5Y8mrIryFi6ST3xVqTxhcg68yV1GPAXbSpnZvbXJOGLua4jg+0w6Zg4GEVHtkequlw6Nr1lOfdDruDTaDOr4LXHrEMiG4MaU/x/HvUam/GJZzgvUvOD9u5U4EElS1vwGMiZq6pBDOcLtNJ8zdGvtH1jXBJfKCfMou7PzRZQrpkntpUH+X2hiOBlfCzti3MFKdDvEOUTR/BjyzHKXfIcWkzJG1AxZVH8z8GglW4yivEAqfB8XfXqeacRIdONs7ttTaemSgvFkS6XqcY30AJzLa0cR05XHCNYxi0OmNhLy6boUR3bbCHVFLCJaeSSx6wpoTrbGcQKkukcFihqwNtahHb3NAl5hZ3eJiALE8tGXwu+uO0MUo9TWd45tMOamJECfXyhDKwZNeJ/TkVMbMyCPP5TQm0a1dtEryFBvyCnwgLj+GpPB6nmwcEUHl4uxE6J203X/8mH81QLBUvSgGi/14Y0hHGc82go0ykKwVlhpzohcv3vz7vbgdjAo1EnUVzNOtBJS6A74hKYv5ssSZnEw2Md7/UH1Zu0D+Wlfon52OCAH7V0T7+UWVXx2v+wQLkeprVipZ5uxQuGninkzrRzQL9YWFnX5zHS7uDsiwC6nZRCkSyafHg80RxhmM8KQ8ZNNbB6dL938bUsU5XrFyTwfqg7G0SM2rFkGT8FbM6jCIgPdjEkBgIHBOHipfaTccSYrej RNfEKTCi lfHccZ4QGsGv+sCf4M/JNx/yPCOesjgb4yPwzOwhJlml0ei9H6Xh8bqulnyKHo+xOxNWD0VvzI7IRe76gbpXZPtTHfw62pK77UFSDd8PicgiTi8eF0uVEgaYxJjWcJMRno4CwAk04E3ELbD3MVJFGTnAifA== 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 --- kernel/sysctl.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index f04da9f3abc6..6e3e0ce4da79 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"