Skip to contentSkip to conversation

mm/vmstat: move vmstat sysctls to its own file

PATCH Superseded tangmeng 1 participant 1 message Feb 20, 2022

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

tangmeng

author
#0 lore raw

PATCH 6/11 mm/vmstat: move vmstat sysctls to its own file

kernel/sysctl.c is a kitchen sink where everyone leaves their dirty dishes, this makes it very difficult to maintain.

To help with this maintenance let's start by moving sysctls to places where they actually belong. The proc sysctl maintainers do not want to know what sysctl knobs you wish to add for your own piece of code, we just care about the core logic.

All filesystem syctls now get reviewed by fs folks. This commit follows the commit of fs, move the vmstat sysctls to its own file, mm/vmstat.c.

vmstat_refresh is defined when CONFIG_PROC_FS is defined, so macro control is added to stat_refresh.

---
 include/linux/vmstat.h |  9 --------
 kernel/sysctl.c        | 25 ---------------------
 mm/vmstat.c            | 50 ++++++++++++++++++++++++++++++++++++++----
 3 files changed, 46 insertions(+), 38 deletions(-)
include/linux/vmstat.h +0 -9
index bfe38869498d..b615d8d7c1d2 100644
@@ -10,15 +10,10 @@
 #include <linux/static_key.h>
 #include <linux/mmdebug.h>
 
-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(struct ctl_table *table, int write,
-		void *buffer, size_t *length, loff_t *ppos);
 #endif
 
 struct reclaim_stat {
@@ -300,10 +295,6 @@ void quiet_vmstat(void);
 void cpu_vm_stats_fold(int cpu);
 void refresh_zone_stat_thresholds(void);
 
-struct ctl_table;
-int vmstat_refresh(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);
kernel/sysctl.c +0 -25
index 62499e3207aa..31f2c6e21392 100644
@@ -2192,15 +2192,6 @@ static struct ctl_table vm_table[] = {
 		.mode           = 0644,
 		.proc_handler   = &hugetlb_mempolicy_sysctl_handler,
 	},
-	{
-		.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	= "hugetlb_shm_group",
@@ -2377,22 +2368,6 @@ static struct ctl_table vm_table[] = {
 		.extra2		= SYSCTL_ONE_HUNDRED,
 	},
 #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",
mm/vmstat.c +46 -4

77 lines not on this page · raw message

Signature · 1 line
2.20.1