Skip to content

Commit 089768d

Browse files
Yajun DengIngo Molnar
authored andcommitted
sched/rt: Change the type of 'sysctl_sched_rt_period' from 'unsigned int' to 'int'
Doing this matches the natural type of 'int' based calculus in sched_rt_handler(), and also enables the adding in of a correct upper bounds check on the sysctl interface. [ mingo: Rewrote the changelog. ] Signed-off-by: Yajun Deng <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f4bb570 commit 089768d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

kernel/sched/rt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct rt_bandwidth def_rt_bandwidth;
1616
* period over which we measure -rt task CPU usage in us.
1717
* default: 1s
1818
*/
19-
unsigned int sysctl_sched_rt_period = 1000000;
19+
int sysctl_sched_rt_period = 1000000;
2020

2121
/*
2222
* part of the period that we allow rt tasks to run in us.
@@ -34,7 +34,7 @@ static struct ctl_table sched_rt_sysctls[] = {
3434
{
3535
.procname = "sched_rt_period_us",
3636
.data = &sysctl_sched_rt_period,
37-
.maxlen = sizeof(unsigned int),
37+
.maxlen = sizeof(int),
3838
.mode = 0644,
3939
.proc_handler = sched_rt_handler,
4040
.extra1 = SYSCTL_ONE,
@@ -47,7 +47,7 @@ static struct ctl_table sched_rt_sysctls[] = {
4747
.mode = 0644,
4848
.proc_handler = sched_rt_handler,
4949
.extra1 = SYSCTL_NEG_ONE,
50-
.extra2 = SYSCTL_INT_MAX,
50+
.extra2 = (void *)&sysctl_sched_rt_period,
5151
},
5252
{
5353
.procname = "sched_rr_timeslice_ms",

kernel/sched/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ extern long calc_load_fold_active(struct rq *this_rq, long adjust);
105105

106106
extern void call_trace_sched_update_nr_running(struct rq *rq, int count);
107107

108-
extern unsigned int sysctl_sched_rt_period;
108+
extern int sysctl_sched_rt_period;
109109
extern int sysctl_sched_rt_runtime;
110110
extern int sched_rr_timeslice;
111111

0 commit comments

Comments
 (0)