sched/cgroup: allow rt tasks in cpu cgroup without group rt scheduler
PATCH 1/1 sched/cgroup: allow rt tasks in cpu cgroup without group rt scheduler
Without group rt scheduler rt tasks works in cpu cgroup perfectly fine. This artificial restriction blocks attaching rt threads to cpu cgroup.
Moreover __sched_setscheduler() never had such check and allow changing policy to rt for threads which are already in non-root cpu cgroup.
Signed-off-by Konstantin Khlebnikov <[email protected]>
--- kernel/sched/core.c | 8 +++----- kernel/sched/rt.c | 9 --------- kernel/sched/sched.h | 1 - 3 files changed, 3 insertions(+), 15 deletions(-)
kernel/sched/core.c +3 -5
@@ -6338,11 +6338,9 @@ static int cpu_cgroup_can_attach(struct cgroup_taskset *tset)cgroup_taskset_for_each (task, css, tset) {#ifdef CONFIG_RT_GROUP_SCHED -if (!sched_rt_can_attach (css_tg (css), task)) -return -EINVAL ; -#else -/* We don't support RT-tasks being in separate groups */ -if (task->sched_class != &fair_sched_class) +/* Don't accept rt tasks when there is no way for them to run */ +if (rt_bandwidth_enabled () &&rt_task (task) && +css_tg (css)->rt_bandwidth.rt_runtime ==0 )return -EINVAL ;#endif /*
kernel/sched/rt.c +0 -9
@@ -2650,15 +2650,6 @@ static int sched_rt_global_constraints(void) return ret; } -int sched_rt_can_attach (struct task_group *tg,struct task_struct *tsk) -{ -/* Don't accept realtime tasks when there is no way for them to run */ -if (rt_task (tsk) && tg->rt_bandwidth.rt_runtime ==0 ) -return 0 ; - -return 1 ; -} -#else /* !CONFIG_RT_GROUP_SCHED */ static int sched_rt_global_constraints (void ) {
kernel/sched/sched.h +0 -1
@@ -387,7 +387,6 @@ extern int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us)extern int sched_group_set_rt_period (struct task_group *tg,u64 rt_period_us);extern long sched_group_rt_runtime (struct task_group *tg);extern long sched_group_rt_period (struct task_group *tg); -extern int sched_rt_can_attach (struct task_group *tg,struct task_struct *tsk);extern struct task_group *sched_create_group (struct task_group *parent); extern void sched_online_group(struct task_group *tg,