[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220210060831.26689-1-nizhen@uniontech.com>
Date: Thu, 10 Feb 2022 14:08:31 +0800
From: Zhen Ni <nizhen@...ontech.com>
To: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, mcgrof@...nel.org,
keescook@...omium.org
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Zhen Ni <nizhen@...ontech.com>
Subject: [PATCH] sched: move rr_timeslice sysctls to rt.c
move rr_timeslice sysctls to rt.c and use the new
register_sysctl_init() to register the sysctl interface.
Signed-off-by: Zhen Ni <nizhen@...ontech.com>
---
include/linux/sched/sysctl.h | 3 ---
kernel/sched/rt.c | 28 ++++++++++++++++++++++++++--
kernel/sysctl.c | 7 -------
3 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index d416d8f45186..f6466040883c 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -45,11 +45,8 @@ extern unsigned int sysctl_sched_uclamp_util_min_rt_default;
extern unsigned int sysctl_sched_autogroup_enabled;
#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 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,
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 7b4f4fbbb404..e8316e0307b0 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -8,10 +8,33 @@
#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;
+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_rr_sysctls[] = {
+ {
+ .procname = "sched_rr_timeslice_ms",
+ .data = &sysctl_sched_rr_timeslice,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = sched_rr_handler,
+ },
+ {}
+};
+
+static void __init sched_rr_sysctl_init(void)
+{
+ register_sysctl_init("kernel", sched_rr_sysctls);
+}
+#else
+#define sched_rr_sysctl_init() do { } while (0)
+#endif
+
static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun);
struct rt_bandwidth def_rt_bandwidth;
@@ -2471,6 +2494,7 @@ void __init init_sched_rt_class(void)
zalloc_cpumask_var_node(&per_cpu(local_cpu_mask, i),
GFP_KERNEL, cpu_to_node(i));
}
+ sched_rr_sysctl_init();
}
#endif /* CONFIG_SMP */
@@ -2967,7 +2991,7 @@ 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;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 981a1902d7a4..d0c45bf6801d 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1720,13 +1720,6 @@ static struct ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec,
},
- {
- .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",
--
2.20.1
Powered by blists - more mailing lists