We added the 'sched_rr_timeslice_ms' SCHED_RR tuning knob in this commit: ce0dbbbb30ae ("sched/rt: Add a tuning knob to allow changing SCHED_RR timeslice") ... which name suggests to users that it's in milliseconds, while in reality it's being set in milliseconds but the result is shown in jiffies. This is obviously confusing when HZ is not 1000, it makes it appear like the value set failed, such as HZ=100: root# echo 100 > /proc/sys/kernel/sched_rr_timeslice_ms root# cat /proc/sys/kernel/sched_rr_timeslice_ms 10 Fix this to be milliseconds all around.
Unified · Split
| @@ -59,6 +59,7 @@ extern unsigned int sysctl_sched_cfs_bandwidth_slice; · 58 unmodified lines | |||
| 59 | extern unsigned int sysctl_sched_autogroup_enabled; | 59 | extern unsigned int sysctl_sched_autogroup_enabled; |
| 60 | #endif | 60 | #endif |
| 61 | 61 | ||
| 62 | extern int sysctl_sched_rr_timeslice; | ||
| 62 | extern int sched_rr_timeslice; | 63 | extern int sched_rr_timeslice; |
| 63 | 64 | ||
| 64 | extern int sched_rr_handler(struct ctl_table *table, int write, | 65 | extern int sched_rr_handler(struct ctl_table *table, int write, |
| @@ -8471,8 +8471,9 @@ int sched_rr_handler(struct ctl_table *table, int write, · 8470 unmodified lines | |||
| 8471 | /* make sure that internally we keep jiffies */ | 8471 | /* make sure that internally we keep jiffies */ |
| 8472 | /* also, writing zero resets timeslice to default */ | 8472 | /* also, writing zero resets timeslice to default */ |
| 8473 | if (!ret && write) { | 8473 | if (!ret && write) { |
| 8474 | sched_rr_timeslice = sched_rr_timeslice <= 0 ? | 8474 | sched_rr_timeslice = |
| 8475 | RR_TIMESLICE : msecs_to_jiffies(sched_rr_timeslice); | 8475 | sysctl_sched_rr_timeslice <= 0 ? RR_TIMESLICE : |
| 8476 | msecs_to_jiffies(sysctl_sched_rr_timeslice); | ||
| 8476 | } | 8477 | } |
| 8477 | mutex_unlock(&mutex); | 8478 | mutex_unlock(&mutex); |
| 8478 | return ret; | 8479 | return ret; |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | |||
| 9 | #include <linux/irq_work.h> | 9 | #include <linux/irq_work.h> |
| 10 | 10 | ||
| 11 | int sched_rr_timeslice = RR_TIMESLICE; | 11 | int sched_rr_timeslice = RR_TIMESLICE; |
| 12 | int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE; | ||
| 12 | 13 | ||
| 13 | static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun); | 14 | static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun); |
| 14 | 15 | ||
| @@ -416,7 +416,7 @@ static struct ctl_table kern_table[] = { · 415 unmodified lines | |||
| 416 | }, | 416 | }, |
| 417 | { | 417 | { |
| 418 | .procname = "sched_rr_timeslice_ms", | 418 | .procname = "sched_rr_timeslice_ms", |
| 419 | .data = &sched_rr_timeslice, | 419 | .data = &sysctl_sched_rr_timeslice, |
| 420 | .maxlen = sizeof(int), | 420 | .maxlen = sizeof(int), |
| 421 | .mode = 0644, | 421 | .mode = 0644, |
| 422 | .proc_handler = sched_rr_handler, | 422 | .proc_handler = sched_rr_handler, |