In cgroup v2, setting a smaller value for sched_rt_runtime_us fails.
PATCH v2 1/1 In cgroup v2, setting a smaller value for sched_rt_runtime_us fails.
For example:
# cat /proc/sys/kernel/sched_rt_runtime_us 950000 # echo 940000 > /proc/sys/kernel/sched_rt_runtime_us -bash: echo: write error: Invalid argument
With CONFIG_RT_GROUP_SCHED enabled, reducing the global RT quota causes the unchanged root cgroup quota to exceed the new global limit. The root cgroup quota should be updated accordingly when the global quota changes.
Adjust the root cgroup's RT quota whenever the global RT quota is modified.
---
Change since v1: https://lore.kernel.org/all/[email protected]/
- Rebase the patch onto mainline.
--- kernel/sched/rt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/sched/rt.c +4 -1
@@ -2858,9 +2858,12 @@ static int sched_rt_global_validate(void)#ifdef CONFIG_RT_GROUP_SCHED if (!rt_group_sched_enabled ())return 0 ; + +u64 period =global_rt_period (); +u64 runtime =global_rt_runtime (); scoped_guard(mutex, &rt_constraints_mutex) -return __rt_schedulable (NULL ,0 ,0 ); +return __rt_schedulable (&root_task_group, period, runtime);#endif return 0 ; }
Signature · 1 line
2.34.1
Quoted 6 lines · Chen Jinghuang
For example:
# cat /proc/sys/kernel/sched_rt_runtime_us 950000 # echo 940000 > /proc/sys/kernel/sched_rt_runtime_us -bash: echo: write error: Invalid argument
Sorry, I forgot that sched_rt_runtime_us is currently set to 1000000, so it should be the following case:
# cat /proc/sys/kernel/sched_rt_runtime_us 1000000 # echo 940000 > /proc/sys/kernel/sched_rt_runtime_us -bash: echo: write error: Invalid argument
Quoted 26 lines
With
CONFIG_RT_GROUP_SCHEDenabled, reducing the global RT quota causes the unchanged root cgroup quota to exceed the new global limit. The root cgroup quota should be updated accordingly when the global quota changes.Adjust the root cgroup's RT quota whenever the global RT quota is modified.
Signed-off-by Chen Jinghuang <[email protected]>Reviewed-by Ridong Chen <[email protected]>Tested-by Madadi Vineeth Reddy <[email protected]>---
Change since v1: https://lore.kernel.org/all/[email protected]/
- Rebase the patch onto mainline.--- kernel/sched/rt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)kernel/sched/rt.c +0
-0@@ -2858,9 +2858,12 @@ static int sched_rt_global_validate(void)#ifdef CONFIG_RT_GROUP_SCHED if (!rt_group_sched_enabled ())return 0 ;
kernel/sched/rt.c static int sched_rt_global_validate(void) · line 2869
Quoted 10 lines
kernel/sched/rt.c +4
-1+ +u64 period =global_rt_period (); +u64 runtime =global_rt_runtime (); scoped_guard(mutex, &rt_constraints_mutex) -return __rt_schedulable (NULL ,0 ,0 ); +return __rt_schedulable (&root_task_group, period, runtime);#endif return 0 ; }
Gently ping!