Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754842AbbHCRGY (ORCPT ); Mon, 3 Aug 2015 13:06:24 -0400 Received: from terminus.zytor.com ([198.137.202.10]:40344 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753466AbbHCRGT (ORCPT ); Mon, 3 Aug 2015 13:06:19 -0400 Date: Mon, 3 Aug 2015 10:05:18 -0700 From: tip-bot for Yuyang Du Message-ID: Cc: umgwanakikbuti@gmail.com, mingo@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, morten.rasmussen@arm.com, tglx@linutronix.de, efault@gmx.de, pjt@google.com, torvalds@linux-foundation.org, yuyang.du@intel.com, bsegall@google.com, hpa@zytor.com, rabin.vincent@axis.com Reply-To: morten.rasmussen@arm.com, peterz@infradead.org, linux-kernel@vger.kernel.org, mingo@kernel.org, umgwanakikbuti@gmail.com, rabin.vincent@axis.com, hpa@zytor.com, bsegall@google.com, yuyang.du@intel.com, torvalds@linux-foundation.org, pjt@google.com, efault@gmx.de, tglx@linutronix.de In-Reply-To: <20150705221151.GF5197@intel.com> References: <20150705221151.GF5197@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Avoid pulling all tasks in idle balancing Git-Commit-ID: 985d3a4c11cd28251bcc7925aa2d7a9038910384 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: 2020 Lines: 53 Commit-ID: 985d3a4c11cd28251bcc7925aa2d7a9038910384 Gitweb: http://git.kernel.org/tip/985d3a4c11cd28251bcc7925aa2d7a9038910384 Author: Yuyang Du AuthorDate: Mon, 6 Jul 2015 06:11:51 +0800 Committer: Ingo Molnar CommitDate: Mon, 3 Aug 2015 12:21:19 +0200 sched/fair: Avoid pulling all tasks in idle balancing In idle balancing where a CPU going idle pulls tasks from another CPU, a livelock may happen if the CPU pulls all tasks from another, makes it idle, and this iterates. So just avoid this. Reported-by: Rabin Vincent Signed-off-by: Yuyang Du Signed-off-by: Peter Zijlstra (Intel) Cc: Ben Segall Cc: Linus Torvalds Cc: Mike Galbraith Cc: Mike Galbraith Cc: Morten Rasmussen Cc: Paul Turner Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20150705221151.GF5197@intel.com Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 587a2f6..8b384b8d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5863,6 +5863,13 @@ static int detach_tasks(struct lb_env *env) return 0; while (!list_empty(tasks)) { + /* + * We don't want to steal all, otherwise we may be treated likewise, + * which could at worst lead to a livelock crash. + */ + if (env->idle != CPU_NOT_IDLE && env->src_rq->nr_running <= 1) + break; + p = list_first_entry(tasks, struct task_struct, se.group_node); env->loop++; -- 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/