lkml.org 
[lkml]   [2017]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] sched/cgroup: allow rt tasks in cpu cgroup without group rt scheduler
From
Date
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 <khlebnikov@yandex-team.ru>
---
kernel/sched/core.c | 8 +++-----
kernel/sched/rt.c | 9 ---------
kernel/sched/sched.h | 1 -
3 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d17c5da523a0..ceb7df51d448 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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
/*
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 0af5ca9e3e3f..e25b460d051f 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -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)
{
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 14db76cd496f..266c5a16ccda 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -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,
\
 
 \ /
  Last update: 2017-10-06 13:49    [W:0.028 / U:0.640 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site