Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756532AbcCaJ2o (ORCPT ); Thu, 31 Mar 2016 05:28:44 -0400 Received: from terminus.zytor.com ([198.137.202.10]:38306 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751484AbcCaJ2l (ORCPT ); Thu, 31 Mar 2016 05:28:41 -0400 Date: Thu, 31 Mar 2016 02:28:03 -0700 From: tip-bot for Srikar Dronamraju Message-ID: Cc: mingo@kernel.org, torvalds@linux-foundation.org, efault@gmx.de, hpa@zytor.com, srikar@linux.vnet.ibm.com, riel@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org Reply-To: srikar@linux.vnet.ibm.com, riel@redhat.com, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, efault@gmx.de, mingo@kernel.org, torvalds@linux-foundation.org, hpa@zytor.com In-Reply-To: <1458735884-30105-1-git-send-email-srikar@linux.vnet.ibm.com> References: <1458735884-30105-1-git-send-email-srikar@linux.vnet.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Reset nr_balance_failed after active balancing Git-Commit-ID: d02c071183e1c01a76811c878c8a52322201f81f 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: 2268 Lines: 63 Commit-ID: d02c071183e1c01a76811c878c8a52322201f81f Gitweb: http://git.kernel.org/tip/d02c071183e1c01a76811c878c8a52322201f81f Author: Srikar Dronamraju AuthorDate: Wed, 23 Mar 2016 17:54:44 +0530 Committer: Ingo Molnar CommitDate: Thu, 31 Mar 2016 10:49:44 +0200 sched/fair: Reset nr_balance_failed after active balancing To force a task migration during active balancing, nr_balance_failed is set to cache_nice_tries + 1. However nr_balance_failed is not reset. As a side effect, the next regular load balance under the same sd, a cache hot task might be migrated, just because nr_balance_failed count is high. Resetting nr_balance_failed after a successful active balance ensures that a hot task is not unreasonably migrated. This can be verified by looking at othe number of hot task migrations reported by /proc/schedstat. Signed-off-by: Srikar Dronamraju Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Mike Galbraith Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1458735884-30105-1-git-send-email-srikar@linux.vnet.ibm.com Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0fe30e6..cbb075e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7399,10 +7399,7 @@ more_balance: &busiest->active_balance_work); } - /* - * We've kicked active balancing, reset the failure - * counter. - */ + /* We've kicked active balancing, force task migration. */ sd->nr_balance_failed = sd->cache_nice_tries+1; } } else @@ -7637,10 +7634,13 @@ static int active_load_balance_cpu_stop(void *data) schedstat_inc(sd, alb_count); p = detach_one_task(&env); - if (p) + if (p) { schedstat_inc(sd, alb_pushed); - else + /* Active balancing done, reset the failure counter. */ + sd->nr_balance_failed = 0; + } else { schedstat_inc(sd, alb_failed); + } } rcu_read_unlock(); out_unlock: