Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched: Bypass bandwitdh checks with runtime disabled RT_GROUP_SCHED

When RT_GROUPs are compiled but not exposed, their bandwidth cannot
be configured (and it is not initialized for non-root task_groups neither).
Therefore bypass any checks of task vs task_group bandwidth.

This will achieve behavior very similar to setups that have
!CONFIG_RT_GROUP_SCHED and attach cpu controller to cgroup v2 hierarchy.
(On a related note, this may allow having RT tasks with
CONFIG_RT_GROUP_SCHED and cgroup v2 hierarchy.)

Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250310170442.504716-7-mkoutny@suse.com

authored by

Michal Koutný and committed by
Peter Zijlstra
277e0909 61d3164f

+8 -3
+5 -1
kernel/sched/core.c
··· 9206 9206 struct task_struct *task; 9207 9207 struct cgroup_subsys_state *css; 9208 9208 9209 + if (!rt_group_sched_enabled()) 9210 + goto scx_check; 9211 + 9209 9212 cgroup_taskset_for_each(task, css, tset) { 9210 9213 if (!sched_rt_can_attach(css_tg(css), task)) 9211 9214 return -EINVAL; 9212 9215 } 9213 - #endif 9216 + scx_check: 9217 + #endif /* CONFIG_RT_GROUP_SCHED */ 9214 9218 return scx_cgroup_can_attach(tset); 9215 9219 } 9216 9220
+1 -1
kernel/sched/rt.c
··· 2864 2864 int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk) 2865 2865 { 2866 2866 /* Don't accept real-time tasks when there is no way for them to run */ 2867 - if (rt_task(tsk) && tg->rt_bandwidth.rt_runtime == 0) 2867 + if (rt_group_sched_enabled() && rt_task(tsk) && tg->rt_bandwidth.rt_runtime == 0) 2868 2868 return 0; 2869 2869 2870 2870 return 1;
+2 -1
kernel/sched/syscalls.c
··· 634 634 * Do not allow real-time tasks into groups that have no runtime 635 635 * assigned. 636 636 */ 637 - if (rt_bandwidth_enabled() && rt_policy(policy) && 637 + if (rt_group_sched_enabled() && 638 + rt_bandwidth_enabled() && rt_policy(policy) && 638 639 task_group(p)->rt_bandwidth.rt_runtime == 0 && 639 640 !task_group_is_autogroup(task_group(p))) { 640 641 retval = -EPERM;