Skip to content

Commit dafd7a9

Browse files
nizhenthmcgrof
authored andcommitted
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@uniontech.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
1 parent 84227c1 commit dafd7a9

4 files changed

Lines changed: 12 additions & 14 deletions

File tree

include/linux/sched/sysctl.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ extern unsigned int sysctl_sched_uclamp_util_min_rt_default;
4141
extern unsigned int sysctl_sched_cfs_bandwidth_slice;
4242
#endif
4343

44-
extern int sysctl_sched_rr_timeslice;
45-
extern int sched_rr_timeslice;
46-
47-
int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
48-
size_t *lenp, loff_t *ppos);
4944
int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
5045
void *buffer, size_t *lenp, loff_t *ppos);
5146
int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,

kernel/sched/rt.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
int sched_rr_timeslice = RR_TIMESLICE;
8-
int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
8+
static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
99
/* More than 4 hours if BW_SHIFT equals 20. */
1010
static const u64 max_rt_runtime = MAX_BW;
1111

@@ -27,6 +27,8 @@ int sysctl_sched_rt_runtime = 950000;
2727

2828
static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
2929
size_t *lenp, loff_t *ppos);
30+
static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
31+
size_t *lenp, loff_t *ppos);
3032
#ifdef CONFIG_SYSCTL
3133
static struct ctl_table sched_rt_sysctls[] = {
3234
{
@@ -43,6 +45,13 @@ static struct ctl_table sched_rt_sysctls[] = {
4345
.mode = 0644,
4446
.proc_handler = sched_rt_handler,
4547
},
48+
{
49+
.procname = "sched_rr_timeslice_ms",
50+
.data = &sysctl_sched_rr_timeslice,
51+
.maxlen = sizeof(int),
52+
.mode = 0644,
53+
.proc_handler = sched_rr_handler,
54+
},
4655
{}
4756
};
4857

@@ -3005,7 +3014,7 @@ static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
30053014
return ret;
30063015
}
30073016

3008-
int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
3017+
static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
30093018
size_t *lenp, loff_t *ppos)
30103019
{
30113020
int ret;

kernel/sched/sched.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ extern void call_trace_sched_update_nr_running(struct rq *rq, int count);
117117

118118
extern unsigned int sysctl_sched_rt_period;
119119
extern int sysctl_sched_rt_runtime;
120+
extern int sched_rr_timeslice;
120121

121122
/*
122123
* Helpers for converting nanosecond timing to jiffy resolution

kernel/sysctl.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,13 +1681,6 @@ static struct ctl_table kern_table[] = {
16811681
.extra2 = SYSCTL_FOUR,
16821682
},
16831683
#endif /* CONFIG_NUMA_BALANCING */
1684-
{
1685-
.procname = "sched_rr_timeslice_ms",
1686-
.data = &sysctl_sched_rr_timeslice,
1687-
.maxlen = sizeof(int),
1688-
.mode = 0644,
1689-
.proc_handler = sched_rr_handler,
1690-
},
16911684
#ifdef CONFIG_UCLAMP_TASK
16921685
{
16931686
.procname = "sched_util_clamp_min",

0 commit comments

Comments
 (0)