linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zefan Li <lizefan@huawei.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>, Tejun Heo <tj@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Cgroups <cgroups@vger.kernel.org>
Subject: [PATCH] sched: Relax a restriction in sched_rt_can_attach()
Date: Mon, 4 May 2015 08:54:36 +0800	[thread overview]
Message-ID: <5546C34C.7050202@huawei.com> (raw)

It's allowed to promote a task from normal to realtime after it has been
attached to a non-root cgroup, but it will fail if the attaching happens
after it has become realtime. I don't see how this restriction is useful.

We are moving toward unified hierarchy where all the cgroup controllers
are bound together, so it would make cgroups easier to use if we have less
restrictions on attaching tasks between cgroups.

Signed-off-by: Zefan Li <lizefan@huawei.com>
---
 kernel/sched/core.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index fe22f75..55c21f7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7800,6 +7800,11 @@ static int sched_rt_global_constraints(void)
 
 	return ret;
 }
+
+static int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
+{
+	return 1;
+}
 #endif /* CONFIG_RT_GROUP_SCHED */
 
 static int sched_dl_global_validate(void)
@@ -8002,16 +8007,9 @@ static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css,
 {
 	struct task_struct *task;
 
-	cgroup_taskset_for_each(task, tset) {
-#ifdef CONFIG_RT_GROUP_SCHED
+	cgroup_taskset_for_each(task, tset)
 		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)
-			return -EINVAL;
-#endif
-	}
 	return 0;
 }
 
-- 
1.9.1


             reply	other threads:[~2015-05-04  0:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04  0:54 Zefan Li [this message]
2015-05-04  3:13 ` [PATCH] sched: Relax a restriction in sched_rt_can_attach() Mike Galbraith
2015-05-04  4:39   ` Zefan Li
2015-05-04  5:10     ` Mike Galbraith
2015-05-04  5:39       ` Mike Galbraith
2015-05-04  9:11         ` Zefan Li
2015-05-04 12:08           ` Mike Galbraith
2015-05-04 12:37           ` Peter Zijlstra
2015-05-04 14:09             ` Mike Galbraith
2015-05-05  3:46               ` Zefan Li
2015-05-05  6:02                 ` Mike Galbraith
2015-05-05  3:54             ` Zefan Li
2015-05-05 14:10               ` Peter Zijlstra
2015-05-05 14:18                 ` Tejun Heo
2015-05-05 15:19                   ` Peter Zijlstra
2015-05-05 16:31                     ` Tejun Heo
2015-05-05 19:00                       ` Peter Zijlstra
2015-05-05 19:06                         ` Tejun Heo
2015-05-06  8:49                           ` Peter Zijlstra
2015-05-05 14:41             ` Tejun Heo
2015-05-05 15:11               ` Peter Zijlstra
2015-05-05 16:13                 ` Tejun Heo
2015-05-05 16:50                   ` Peter Zijlstra
2015-05-05 18:29                     ` Thomas Gleixner
2015-05-05 19:00                       ` Tejun Heo
2015-05-06  9:12                         ` Thomas Gleixner
2015-05-05 18:31                     ` Tejun Heo
2015-05-05 14:09         ` Tejun Heo

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=5546C34C.7050202@huawei.com \
    --to=lizefan@huawei.com \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).