Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751820AbbEDAzI (ORCPT ); Sun, 3 May 2015 20:55:08 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:18171 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750969AbbEDAzD (ORCPT ); Sun, 3 May 2015 20:55:03 -0400 Message-ID: <5546C34C.7050202@huawei.com> Date: Mon, 4 May 2015 08:54:36 +0800 From: Zefan Li User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Ingo Molnar CC: Peter Zijlstra , Tejun Heo , LKML , Cgroups Subject: [PATCH] sched: Relax a restriction in sched_rt_can_attach() X-Enigmail-Version: 1.6 Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.18.230] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1680 Lines: 55 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/