From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH] sched/cgroup: allow rt tasks in cpu cgroup without group rt scheduler
Date: Fri, 06 Oct 2017 14:48:58 +0300 [thread overview]
Message-ID: <150729053840.744865.8446192218258392956.stgit@buzz> (raw)
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,
reply other threads:[~2017-10-06 11:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=150729053840.744865.8446192218258392956.stgit@buzz \
--to=khlebnikov@yandex-team.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®