Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753512AbbBRRLI (ORCPT ); Wed, 18 Feb 2015 12:11:08 -0500 Received: from terminus.zytor.com ([198.137.202.10]:39153 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752778AbbBRRLE (ORCPT ); Wed, 18 Feb 2015 12:11:04 -0500 Date: Wed, 18 Feb 2015 09:09:36 -0800 From: tip-bot for Peter Zijlstra Message-ID: Cc: stefan.bader@canonical.com, mingo@kernel.org, peterz@infradead.org, lizefan@huawei.com, hpa@zytor.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, umgwanakikbuti@gmail.com, torvalds@linux-foundation.org Reply-To: torvalds@linux-foundation.org, mingo@kernel.org, stefan.bader@canonical.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, umgwanakikbuti@gmail.com, lizefan@huawei.com, peterz@infradead.org In-Reply-To: <20150209112237.GR5029@twins.programming.kicks-ass.net> References: <20150209112237.GR5029@twins.programming.kicks-ass.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/autogroup: Fix failure to set cpu.rt_runtime_us Git-Commit-ID: 1fe89e1b6d270aa0d3452c60d38461ea589594e3 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3389 Lines: 86 Commit-ID: 1fe89e1b6d270aa0d3452c60d38461ea589594e3 Gitweb: http://git.kernel.org/tip/1fe89e1b6d270aa0d3452c60d38461ea589594e3 Author: Peter Zijlstra AuthorDate: Mon, 9 Feb 2015 11:53:18 +0100 Committer: Ingo Molnar CommitDate: Wed, 18 Feb 2015 16:17:20 +0100 sched/autogroup: Fix failure to set cpu.rt_runtime_us Because task_group() uses a cache of autogroup_task_group(), whose output depends on sched_class, switching classes can generate problems. In particular, when started as fair, the cache points to the autogroup, so when switching to RT the tg_rt_schedulable() test fails for every cpu.rt_{runtime,period}_us change because now the autogroup has tasks and no runtime. Furthermore, going back to the previous semantics of varying task_group() with sched_class has the down-side that the sched_debug output varies as well, even though the task really is in the autogroup. Therefore add an autogroup exception to tg_has_rt_tasks() -- such that both (all) task_group() usages in sched/core now have one. And remove all the remnants of the variable task_group() output. Reported-by: Zefan Li Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Mike Galbraith Cc: Stefan Bader Fixes: 8323f26ce342 ("sched: Fix race in task_group()") Link: http://lkml.kernel.org/r/20150209112237.GR5029@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar --- kernel/sched/auto_group.c | 6 +----- kernel/sched/core.c | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/sched/auto_group.c b/kernel/sched/auto_group.c index 8a2e230..eae160d 100644 --- a/kernel/sched/auto_group.c +++ b/kernel/sched/auto_group.c @@ -87,8 +87,7 @@ static inline struct autogroup *autogroup_create(void) * so we don't have to move tasks around upon policy change, * or flail around trying to allocate bandwidth on the fly. * A bandwidth exception in __sched_setscheduler() allows - * the policy change to proceed. Thereafter, task_group() - * returns &root_task_group, so zero bandwidth is required. + * the policy change to proceed. */ free_rt_sched_group(tg); tg->rt_se = root_task_group.rt_se; @@ -115,9 +114,6 @@ bool task_wants_autogroup(struct task_struct *p, struct task_group *tg) if (tg != &root_task_group) return false; - if (p->sched_class != &fair_sched_class) - return false; - /* * We can only assume the task group can't go away on us if * autogroup_move_group() can see us on ->thread_group list. diff --git a/kernel/sched/core.c b/kernel/sched/core.c index daaea92..03a67f0 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7577,6 +7577,12 @@ static inline int tg_has_rt_tasks(struct task_group *tg) { struct task_struct *g, *p; + /* + * Autogroups do not have RT tasks; see autogroup_create(). + */ + if (task_group_is_autogroup(tg)) + return 0; + for_each_process_thread(g, p) { if (rt_task(p) && task_group(p) == tg) return 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/