Skip to contentSkip to conversation

sched: Move a series of sysctls starting with sys/kernel/sched_*

PATCH In review Zhen Ni 4 participants 13 messages Feb 15, 2022 – Feb 20, 2022

Subsystems (4)
lore
Share & tools
lore

Zhen Ni

author
#0 lore raw

v3 cover sched: Move a series of sysctls starting with sys/kernel/sched_*

move a series of sysctls starting with sys/kernel/sched_* and use the new register_sysctl_init() to register the sysctl interface.

Zhen Ni (8):
sched: Move child_runs_first sysctls to fair.c
sched: Move schedstats sysctls to core.c
sched: Move rt_period/runtime sysctls to rt.c
sched: Move deadline_period sysctls to deadline.c
sched: Move rr_timeslice sysctls to rt.c
sched: Move uclamp_util sysctls to core.c
sched: Move cfs_bandwidth_slice sysctls to fair.c
sched: Move energy_aware sysctls to topology.c

 include/linux/sched/sysctl.h | 41 ---------------
 kernel/rcu/rcu.h             |  2 +
 kernel/sched/core.c          | 69 ++++++++++++++++++-------
 kernel/sched/deadline.c      | 42 +++++++++++++---
 kernel/sched/fair.c          | 32 +++++++++++-
 kernel/sched/rt.c            | 56 +++++++++++++++++++--
 kernel/sched/sched.h         |  7 +++
 kernel/sched/topology.c      | 25 +++++++++-
 kernel/sysctl.c              | 97 ------------------------------------
 9 files changed, 201 insertions(+), 170 deletions(-)
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH v3 1/8 sched: Move child_runs_first sysctls to fair.c

move child_runs_first sysctls to fair.c and use the new register_sysctl_init() to register the sysctl interface.

---
 include/linux/sched/sysctl.h |  2 --
 kernel/sched/fair.c          | 19 +++++++++++++++++++
 kernel/sched/sched.h         |  2 ++
 kernel/sysctl.c              |  7 -------
 4 files changed, 21 insertions(+), 9 deletions(-)
include/linux/sched/sysctl.h +0 -2
index 3f2b70f8d32c..5490ba24783a 100644
@@ -14,8 +14,6 @@ extern unsigned long sysctl_hung_task_timeout_secs;
 enum { sysctl_hung_task_timeout_secs = 0 };
 #endif
 
-extern unsigned int sysctl_sched_child_runs_first;
-
 enum sched_tunable_scaling {
 	SCHED_TUNABLESCALING_NONE,
 	SCHED_TUNABLESCALING_LOG,
kernel/sched/fair.c +19 -0
index 8fc35fd779f8..4ac1bfe8ca4f 100644
@@ -77,6 +77,25 @@ static unsigned int sched_nr_latency = 8;
  * parent will (try to) run first.
  */
 unsigned int sysctl_sched_child_runs_first __read_mostly;
+#ifdef CONFIG_SYSCTL
+static struct ctl_table sched_child_runs_first_sysctls[] = {
+	{
+		.procname       = "sched_child_runs_first",
+		.data           = &sysctl_sched_child_runs_first,
+		.maxlen         = sizeof(unsigned int),
+		.mode           = 0644,
+		.proc_handler   = proc_dointvec,
+	},
+	{}
+};
+
+static int __init sched_child_runs_first_sysctl_init(void)
+{
+	register_sysctl_init("kernel", sched_child_runs_first_sysctls);
+	return 0;
+}
+late_initcall(sched_child_runs_first_sysctl_init);
+#endif
 
 /*
  * SCHED_OTHER wake-up granularity.
kernel/sched/sched.h +2 -0
index 9b33ba9c3c42..27465635c774 100644
@@ -96,6 +96,8 @@ extern __read_mostly int scheduler_running;
 extern unsigned long calc_load_update;
 extern atomic_long_t calc_load_tasks;
 
+extern unsigned int sysctl_sched_child_runs_first;
+
 extern void calc_global_load_tick(struct rq *this_rq);
 extern long calc_load_fold_active(struct rq *this_rq, long adjust);
 
kernel/sysctl.c +0 -7
index 1cb7ca68cd4e..24a99b5b7da8 100644
@@ -1652,13 +1652,6 @@ int proc_do_static_key(struct ctl_table *table, int write,
 }
 
 static struct ctl_table kern_table[] = {
-	{
-		.procname	= "sched_child_runs_first",
-		.data		= &sysctl_sched_child_runs_first,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
 #ifdef CONFIG_SCHEDSTATS
 	{
 		.procname	= "sched_schedstats",
Signature · 1 line
2.20.1
author
#2 lore raw

PATCH v3 2/8 sched: Move schedstats sysctls to core.c

In reply to Zhen Ni

move schedstats sysctls to core.c and use the new register_sysctl_init() to register the sysctl interface.

---
 include/linux/sched/sysctl.h |  2 --
 kernel/sched/core.c          | 22 +++++++++++++++++++++-
 kernel/sysctl.c              | 11 -----------
 3 files changed, 21 insertions(+), 14 deletions(-)
include/linux/sched/sysctl.h +0 -2
index 5490ba24783a..ffe42509a595 100644
@@ -54,8 +54,6 @@ int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
 		void *buffer, size_t *lenp, loff_t *ppos);
 int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos);
-int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
-		size_t *lenp, loff_t *ppos);
 
 #if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
 extern unsigned int sysctl_sched_energy_aware;
kernel/sched/core.c +21 -1
index 0bf0dc3adf57..3c1239c61b45 100644
@@ -4354,7 +4354,7 @@ static int __init setup_schedstats(char *str)
 __setup("schedstats=", setup_schedstats);
 
 #ifdef CONFIG_PROC_SYSCTL
-int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
+static int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos)
 {
 	struct ctl_table t;
@@ -4373,6 +4373,26 @@ int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
 		set_schedstats(state);
 	return err;
 }
+
+static struct ctl_table sched_schedstats_sysctls[] = {
+	{
+		.procname       = "sched_schedstats",
+		.data           = NULL,
+		.maxlen         = sizeof(unsigned int),
+		.mode           = 0644,
+		.proc_handler   = sysctl_schedstats,
+		.extra1         = SYSCTL_ZERO,
+		.extra2         = SYSCTL_ONE,
+	},
+	{}
+};
+
+static int __init sched_schedstats_sysctl_init(void)
+{
+	register_sysctl_init("kernel", sched_schedstats_sysctls);
+	return 0;
+}
+late_initcall(sched_schedstats_sysctl_init);
 #endif /* CONFIG_PROC_SYSCTL */
 #endif /* CONFIG_SCHEDSTATS */
 
kernel/sysctl.c +0 -11
index 24a99b5b7da8..88ff6b27f8ab 100644
@@ -1652,17 +1652,6 @@ int proc_do_static_key(struct ctl_table *table, int write,
 }
 
 static struct ctl_table kern_table[] = {
-#ifdef CONFIG_SCHEDSTATS
-	{
-		.procname	= "sched_schedstats",
-		.data		= NULL,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= sysctl_schedstats,
-		.extra1		= SYSCTL_ZERO,
-		.extra2		= SYSCTL_ONE,
-	},
-#endif /* CONFIG_SCHEDSTATS */
 #ifdef CONFIG_TASK_DELAY_ACCT
 	{
 		.procname	= "task_delayacct",
Signature · 1 line
2.20.1
author
#3 lore raw

PATCH v3 3/8 sched: Move rt_period/runtime sysctls to rt.c

In reply to Zhen Ni

move rt_period/runtime sysctls to rt.c and use the new register_sysctl_init() to register the sysctl interface.

---
 include/linux/sched/sysctl.h | 11 ---------
 kernel/rcu/rcu.h             |  2 ++
 kernel/sched/core.c          | 13 -----------
 kernel/sched/rt.c            | 43 +++++++++++++++++++++++++++++++++++-
 kernel/sched/sched.h         |  4 ++++
 kernel/sysctl.c              | 14 ------------
 6 files changed, 48 insertions(+), 39 deletions(-)
include/linux/sched/sysctl.h +0 -11
index ffe42509a595..99fbf61464ab 100644
@@ -21,15 +21,6 @@ enum sched_tunable_scaling {
 	SCHED_TUNABLESCALING_END,
 };
 
-/*
- *  control realtime throttling:
- *
- *  /proc/sys/kernel/sched_rt_period_us
- *  /proc/sys/kernel/sched_rt_runtime_us
- */
-extern unsigned int sysctl_sched_rt_period;
-extern int sysctl_sched_rt_runtime;
-
 extern unsigned int sysctl_sched_dl_period_max;
 extern unsigned int sysctl_sched_dl_period_min;
 
@@ -48,8 +39,6 @@ extern int sched_rr_timeslice;
 
 int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos);
-int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
-		size_t *lenp, loff_t *ppos);
 int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
 		void *buffer, size_t *lenp, loff_t *ppos);
 int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
kernel/rcu/rcu.h +2 -0
index 24b5f2c2de87..7812c740b3bf 100644
@@ -23,6 +23,8 @@
 #define RCU_SEQ_CTR_SHIFT	2
 #define RCU_SEQ_STATE_MASK	((1 << RCU_SEQ_CTR_SHIFT) - 1)
 
+extern int sysctl_sched_rt_runtime;
+
 /*
  * Return the counter portion of a sequence number previously returned
  * by rcu_seq_snap() or rcu_seq_current().
kernel/sched/core.c +0 -13
index 3c1239c61b45..276033cceaf2 100644
@@ -81,12 +81,6 @@ const_debug unsigned int sysctl_sched_nr_migrate = 8;
 const_debug unsigned int sysctl_sched_nr_migrate = 32;
 #endif
 
-/*
- * period over which we measure -rt task CPU usage in us.
- * default: 1s
- */
-unsigned int sysctl_sched_rt_period = 1000000;
-
 __read_mostly int scheduler_running;
 
 #ifdef CONFIG_SCHED_CORE
@@ -380,13 +374,6 @@ sched_core_dequeue(struct rq *rq, struct task_struct *p, int flags) { }
 
 #endif /* CONFIG_SCHED_CORE */
 
-/*
- * part of the period that we allow rt tasks to run in us.
- * default: 0.95s
- */
-int sysctl_sched_rt_runtime = 950000;
-
-
 /*
  * Serialization rules:
  *
kernel/sched/rt.c +42 -1

55 lines not on this page · raw message

kernel/sched/sched.h +4 -0
index 27465635c774..385e74095434 100644
@@ -102,6 +102,10 @@ extern void calc_global_load_tick(struct rq *this_rq);
 extern long calc_load_fold_active(struct rq *this_rq, long adjust);
 
 extern void call_trace_sched_update_nr_running(struct rq *rq, int count);
+
+extern unsigned int sysctl_sched_rt_period;
+extern int sysctl_sched_rt_runtime;
+
 /*
  * Helpers for converting nanosecond timing to jiffy resolution
  */
kernel/sysctl.c +0 -14
index 88ff6b27f8ab..73cccd935d65 100644
@@ -1674,20 +1674,6 @@ static struct ctl_table kern_table[] = {
 		.extra2		= SYSCTL_ONE,
 	},
 #endif /* CONFIG_NUMA_BALANCING */
-	{
-		.procname	= "sched_rt_period_us",
-		.data		= &sysctl_sched_rt_period,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= sched_rt_handler,
-	},
-	{
-		.procname	= "sched_rt_runtime_us",
-		.data		= &sysctl_sched_rt_runtime,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= sched_rt_handler,
-	},
 	{
 		.procname	= "sched_deadline_period_max_us",
 		.data		= &sysctl_sched_dl_period_max,
Signature · 1 line
2.20.1
author
#4 lore raw

PATCH v3 4/8 sched: Move deadline_period sysctls to deadline.c

In reply to Zhen Ni

move deadline_period sysctls to deadline.c and use the new register_sysctl_init() to register the sysctl interface.

---
 include/linux/sched/sysctl.h |  3 ---
 kernel/sched/deadline.c      | 42 +++++++++++++++++++++++++++++-------
 kernel/sysctl.c              | 14 ------------
 3 files changed, 34 insertions(+), 25 deletions(-)
include/linux/sched/sysctl.h +0 -3
index 99fbf61464ab..81187a8c625d 100644
@@ -21,9 +21,6 @@ enum sched_tunable_scaling {
 	SCHED_TUNABLESCALING_END,
 };
 
-extern unsigned int sysctl_sched_dl_period_max;
-extern unsigned int sysctl_sched_dl_period_min;
-
 #ifdef CONFIG_UCLAMP_TASK
 extern unsigned int sysctl_sched_uclamp_util_min;
 extern unsigned int sysctl_sched_uclamp_util_max;
kernel/sched/deadline.c +34 -8

54 lines not on this page · raw message

kernel/sysctl.c +0 -14
index 73cccd935d65..f4434d22246b 100644
@@ -1674,20 +1674,6 @@ static struct ctl_table kern_table[] = {
 		.extra2		= SYSCTL_ONE,
 	},
 #endif /* CONFIG_NUMA_BALANCING */
-	{
-		.procname	= "sched_deadline_period_max_us",
-		.data		= &sysctl_sched_dl_period_max,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.procname	= "sched_deadline_period_min_us",
-		.data		= &sysctl_sched_dl_period_min,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
 	{
 		.procname	= "sched_rr_timeslice_ms",
 		.data		= &sysctl_sched_rr_timeslice,
Signature · 1 line
2.20.1
author
#5 lore raw

PATCH v3 5/8 sched: Move rr_timeslice sysctls to rt.c

In reply to Zhen Ni

move rr_timeslice sysctls to rt.c and use the new register_sysctl_init() to register the sysctl interface.

---
 include/linux/sched/sysctl.h |  5 -----
 kernel/sched/rt.c            | 13 +++++++++++--
 kernel/sched/sched.h         |  1 +
 kernel/sysctl.c              |  7 -------
 4 files changed, 12 insertions(+), 14 deletions(-)
include/linux/sched/sysctl.h +0 -5
index 81187a8c625d..5515b54bfb57 100644
@@ -31,11 +31,6 @@ extern unsigned int sysctl_sched_uclamp_util_min_rt_default;
 extern unsigned int sysctl_sched_cfs_bandwidth_slice;
 #endif
 
-extern int sysctl_sched_rr_timeslice;
-extern int sched_rr_timeslice;
-
-int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
-		size_t *lenp, loff_t *ppos);
 int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
 		void *buffer, size_t *lenp, loff_t *ppos);
 int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
kernel/sched/rt.c +11 -2
index 1106828c4236..95e4d5f31caa 100644
@@ -8,7 +8,7 @@
 #include "pelt.h"
 
 int sched_rr_timeslice = RR_TIMESLICE;
-int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
+static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
 /* More than 4 hours if BW_SHIFT equals 20. */
 static const u64 max_rt_runtime = MAX_BW;
 
@@ -30,6 +30,8 @@ int sysctl_sched_rt_runtime = 950000;
 
 static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos);
+static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
+		size_t *lenp, loff_t *ppos);
 #ifdef CONFIG_SYSCTL
 static struct ctl_table sched_rt_sysctls[] = {
 	{
@@ -46,6 +48,13 @@ static struct ctl_table sched_rt_sysctls[] = {
 		.mode           = 0644,
 		.proc_handler   = sched_rt_handler,
 	},
+	{
+		.procname       = "sched_rr_timeslice_ms",
+		.data           = &sysctl_sched_rr_timeslice,
+		.maxlen         = sizeof(int),
+		.mode           = 0644,
+		.proc_handler   = sched_rr_handler,
+	},
 	{}
 };
 
@@ -3008,7 +3017,7 @@ static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
 	return ret;
 }
 
-int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
+static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos)
 {
 	int ret;
kernel/sched/sched.h +1 -0
index 385e74095434..2d3451e06c55 100644
@@ -105,6 +105,7 @@ extern void call_trace_sched_update_nr_running(struct rq *rq, int count);
 
 extern unsigned int sysctl_sched_rt_period;
 extern int sysctl_sched_rt_runtime;
+extern int sched_rr_timeslice;
 
 /*
  * Helpers for converting nanosecond timing to jiffy resolution
kernel/sysctl.c +0 -7
index f4434d22246b..cfcbd17005af 100644
@@ -1674,13 +1674,6 @@ static struct ctl_table kern_table[] = {
 		.extra2		= SYSCTL_ONE,
 	},
 #endif /* CONFIG_NUMA_BALANCING */
-	{
-		.procname	= "sched_rr_timeslice_ms",
-		.data		= &sysctl_sched_rr_timeslice,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= sched_rr_handler,
-	},
 #ifdef CONFIG_UCLAMP_TASK
 	{
 		.procname	= "sched_util_clamp_min",
Signature · 1 line
2.20.1
author
#6 lore raw

PATCH v3 6/8 sched: Move uclamp_util sysctls to core.c

In reply to Zhen Ni

move uclamp_util sysctls to core.c and use the new register_sysctl_init() to register the sysctl interface.

---
 include/linux/sched/sysctl.h |  8 ------
 kernel/sched/core.c          | 48 +++++++++++++++++++++++++++---------
 kernel/sysctl.c              | 23 -----------------
 3 files changed, 37 insertions(+), 42 deletions(-)
include/linux/sched/sysctl.h +0 -8
index 5515b54bfb57..9fe879602c4f 100644
@@ -21,18 +21,10 @@ enum sched_tunable_scaling {
 	SCHED_TUNABLESCALING_END,
 };
 
-#ifdef CONFIG_UCLAMP_TASK
-extern unsigned int sysctl_sched_uclamp_util_min;
-extern unsigned int sysctl_sched_uclamp_util_max;
-extern unsigned int sysctl_sched_uclamp_util_min_rt_default;
-#endif
-
 #ifdef CONFIG_CFS_BANDWIDTH
 extern unsigned int sysctl_sched_cfs_bandwidth_slice;
 #endif
 
-int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
-		void *buffer, size_t *lenp, loff_t *ppos);
 int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos);
 
kernel/sched/core.c +37 -11

86 lines not on this page · raw message

kernel/sysctl.c +0 -23
index cfcbd17005af..d811e471f7d3 100644
@@ -1674,29 +1674,6 @@ static struct ctl_table kern_table[] = {
 		.extra2		= SYSCTL_ONE,
 	},
 #endif /* CONFIG_NUMA_BALANCING */
-#ifdef CONFIG_UCLAMP_TASK
-	{
-		.procname	= "sched_util_clamp_min",
-		.data		= &sysctl_sched_uclamp_util_min,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= sysctl_sched_uclamp_handler,
-	},
-	{
-		.procname	= "sched_util_clamp_max",
-		.data		= &sysctl_sched_uclamp_util_max,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= sysctl_sched_uclamp_handler,
-	},
-	{
-		.procname	= "sched_util_clamp_min_rt_default",
-		.data		= &sysctl_sched_uclamp_util_min_rt_default,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= sysctl_sched_uclamp_handler,
-	},
-#endif
 #ifdef CONFIG_CFS_BANDWIDTH
 	{
 		.procname	= "sched_cfs_bandwidth_slice_us",
Signature · 1 line
2.20.1
author
#7 lore raw

PATCH v3 7/8 sched: Move cfs_bandwidth_slice sysctls to fair.c

In reply to Zhen Ni

move cfs_bandwidth_slice sysctls to fair.c and use the new register_sysctl_init() to register the sysctl interface.

---
 include/linux/sched/sysctl.h |  4 ---
 kernel/sched/fair.c          | 51 ++++++++++++++++++++++--------------
 kernel/sysctl.c              | 10 -------
 3 files changed, 31 insertions(+), 34 deletions(-)
include/linux/sched/sysctl.h +0 -4
index 9fe879602c4f..053688eafd51 100644
@@ -21,10 +21,6 @@ enum sched_tunable_scaling {
 	SCHED_TUNABLESCALING_END,
 };
 
-#ifdef CONFIG_CFS_BANDWIDTH
-extern unsigned int sysctl_sched_cfs_bandwidth_slice;
-#endif
-
 int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos);
 
kernel/sched/fair.c +31 -20

63 lines not on this page · raw message

kernel/sysctl.c +0 -10
index d811e471f7d3..21b797906cc4 100644
@@ -1674,16 +1674,6 @@ static struct ctl_table kern_table[] = {
 		.extra2		= SYSCTL_ONE,
 	},
 #endif /* CONFIG_NUMA_BALANCING */
-#ifdef CONFIG_CFS_BANDWIDTH
-	{
-		.procname	= "sched_cfs_bandwidth_slice_us",
-		.data		= &sysctl_sched_cfs_bandwidth_slice,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec_minmax,
-		.extra1		= SYSCTL_ONE,
-	},
-#endif
 #if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
 	{
 		.procname	= "sched_energy_aware",
Signature · 1 line
2.20.1
author
#8 lore raw

PATCH v3 8/8 sched: Move energy_aware sysctls to topology.c

In reply to Zhen Ni

move energy_aware sysctls to topology.c and use the new register_sysctl_init() to register the sysctl interface.

---
 include/linux/sched/sysctl.h |  6 ------
 kernel/sched/topology.c      | 25 +++++++++++++++++++++++--
 kernel/sysctl.c              | 11 -----------
 3 files changed, 23 insertions(+), 19 deletions(-)
include/linux/sched/sysctl.h +0 -6
index 053688eafd51..b6a4063e388d 100644
@@ -24,10 +24,4 @@ enum sched_tunable_scaling {
 int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos);
 
-#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
-extern unsigned int sysctl_sched_energy_aware;
-int sched_energy_aware_handler(struct ctl_table *table, int write,
-		void *buffer, size_t *lenp, loff_t *ppos);
-#endif
-
 #endif /* _LINUX_SCHED_SYSCTL_H */
kernel/sched/topology.c +23 -2
index d201a7052a29..409e27af2034 100644
@@ -207,7 +207,7 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
 
 #if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
 DEFINE_STATIC_KEY_FALSE(sched_energy_present);
-unsigned int sysctl_sched_energy_aware = 1;
+static unsigned int sysctl_sched_energy_aware = 1;
 DEFINE_MUTEX(sched_energy_mutex);
 bool sched_energy_update;
 
@@ -221,7 +221,7 @@ void rebuild_sched_domains_energy(void)
 }
 
 #ifdef CONFIG_PROC_SYSCTL
-int sched_energy_aware_handler(struct ctl_table *table, int write,
+static int sched_energy_aware_handler(struct ctl_table *table, int write,
 		void *buffer, size_t *lenp, loff_t *ppos)
 {
 	int ret, state;
@@ -238,6 +238,27 @@ int sched_energy_aware_handler(struct ctl_table *table, int write,
 
 	return ret;
 }
+
+static struct ctl_table sched_energy_aware_sysctls[] = {
+	{
+		.procname       = "sched_energy_aware",
+		.data           = &sysctl_sched_energy_aware,
+		.maxlen         = sizeof(unsigned int),
+		.mode           = 0644,
+		.proc_handler   = sched_energy_aware_handler,
+		.extra1         = SYSCTL_ZERO,
+		.extra2         = SYSCTL_ONE,
+	},
+	{}
+};
+
+static int __init sched_energy_aware_sysctl_init(void)
+{
+	register_sysctl_init("kernel", sched_energy_aware_sysctls);
+	return 0;
+}
+
+late_initcall(sched_energy_aware_sysctl_init);
 #endif
 
 static void free_pd(struct perf_domain *pd)
kernel/sysctl.c +0 -11
index 21b797906cc4..ee6701ea73ea 100644
@@ -1674,17 +1674,6 @@ static struct ctl_table kern_table[] = {
 		.extra2		= SYSCTL_ONE,
 	},
 #endif /* CONFIG_NUMA_BALANCING */
-#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
-	{
-		.procname	= "sched_energy_aware",
-		.data		= &sysctl_sched_energy_aware,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= sched_energy_aware_handler,
-		.extra1		= SYSCTL_ZERO,
-		.extra2		= SYSCTL_ONE,
-	},
-#endif
 #ifdef CONFIG_PROVE_LOCKING
 	{
 		.procname	= "prove_locking",
Signature · 1 line
2.20.1
#9 lore raw
In reply to Zhen Ni
Quoted 2 lines · Zhen Ni

move a series of sysctls starting with sys/kernel/sched_* and use the new register_sysctl_init() to register the sysctl interface.

Peter, Andrew,

I'm starting to get more sysctl patches under kernel/ other than the scheduler. To avoid low quality patches, try to see proactively what conflicts may lie ahead, ensure everything is applies on linux-next, and to ensure all this gets baked through 0-day for a while, I'm going to shove all pending patches into a sysctl-next branch based on Linus' tree.

I think it doesn't make sense now to just say, do this for sched for one release. I think we need to get these more widely tested in a faster way, and to get conflicts ironed out faster too.

Are you folks OK if say Stephen adds a sysctl-next for linux-next so we can beat on these there too?

FWIW queued on sysctl-next [0].

[0] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=sysctl-next

Luis

#10 lore raw
Quoted 2 lines · On Wed, 16 Feb 2022 23:51:08 -0800 Luis Chamberlain <[email protected]> wrote:

Are you folks OK if say Stephen adds a sysctl-next for linux-next so we can beat on these there too?

Sure. I just sent you a couple which I've collected.

#11 lore raw
Quoted 6 lines · Andrew Morton
Quoted 2 lines · On Wed, 16 Feb 2022 23:51:08 -0800 Luis Chamberlain <[email protected]> wrote:

Are you folks OK if say Stephen adds a sysctl-next for linux-next so we can beat on these there too?

Sure. I just sent you a couple which I've collected.

OK thanks! I've merged those into sysctl-next [0]

Stephen,

Can you add it to the set of trees you pull? I'll send a patch to add this to MAINTAINERS too then.

[0] git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git sysctl-next

Luis

#12 lore raw

Hi Luis,

Quoted 9 lines · On Fri, 18 Feb 2022 10:21:56 -0800 Luis Chamberlain <[email protected]> wrote:
Quoted 6 lines · Andrew Morton
Quoted 2 lines · On Wed, 16 Feb 2022 23:51:08 -0800 Luis Chamberlain <[email protected]> wrote:

Are you folks OK if say Stephen adds a sysctl-next for linux-next so we can beat on these there too?

Sure. I just sent you a couple which I've collected.

Quoted 8 lines

OK thanks! I've merged those into sysctl-next [0]

Stephen,

Can you add it to the set of trees you pull? I'll send a patch to add this to MAINTAINERS too then.

[0] git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git sysctl-next

Added from whenever the next linux-next tree gets done.

Thanks for adding your subsystem tree as a participant of linux-next. As you may know, this is not a judgement of your code. The purpose of linux-next is for integration testing and to lower the impact of conflicts between subsystems in the next merge window.

You will need to ensure that the patches/commits in your tree/series have been:
* submitted under GPL v2 (or later) and include the Contributor's Signed-off-by,
* posted to the relevant mailing list,
* reviewed by you (or another maintainer of your subsystem tree),
* successfully unit tested, and
* destined for the current or next Linux merge window.

Basically, this should be just what you would send to Linus (or ask him to fetch). It is allowed to be rebased if you deem it necessary.

Signature · 3 lines
Cheers,
Stephen Rothwell 
[email protected]