Skip to content

Commit c1fc648

Browse files
metan-ucwPeter Zijlstra
authored andcommitted
sched/rt: sysctl_sched_rr_timeslice show default timeslice after reset
The sched_rr_timeslice can be reset to default by writing value that is <= 0. However after reading from this file we always got the last value written, which is not useful at all. $ echo -1 > /proc/sys/kernel/sched_rr_timeslice_ms $ cat /proc/sys/kernel/sched_rr_timeslice_ms -1 Fix this by setting the variable that holds the sysctl file value to the jiffies_to_msecs(RR_TIMESLICE) in case that <= 0 value was written. Signed-off-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Petr Vorel <pvorel@suse.cz> Acked-by: Mel Gorman <mgorman@suse.de> Tested-by: Petr Vorel <pvorel@suse.cz> Link: https://lore.kernel.org/r/20230802151906.25258-3-chrubis@suse.cz
1 parent c7fcb99 commit c1fc648

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/sched/rt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,6 +3062,9 @@ static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
30623062
sched_rr_timeslice =
30633063
sysctl_sched_rr_timeslice <= 0 ? RR_TIMESLICE :
30643064
msecs_to_jiffies(sysctl_sched_rr_timeslice);
3065+
3066+
if (sysctl_sched_rr_timeslice <= 0)
3067+
sysctl_sched_rr_timeslice = jiffies_to_msecs(RR_TIMESLICE);
30653068
}
30663069
mutex_unlock(&mutex);
30673070

0 commit comments

Comments
 (0)