public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: fix load_balance redo for null imbalance
@ 2018-09-07  7:51 Vincent Guittot
  2018-09-07 11:37 ` Peter Zijlstra
  2018-09-10 10:08 ` [tip:sched/core] sched/fair: Fix load_balance redo for !imbalance tip-bot for Vincent Guittot
  0 siblings, 2 replies; 8+ messages in thread
From: Vincent Guittot @ 2018-09-07  7:51 UTC (permalink / raw)
  To: peterz, mingo, linux-kernel; +Cc: dietmar.eggemann, jhugo, Vincent Guittot

It can happen that load_balance finds a busiest group and then a busiest rq
but the calculated imbalance is in fact null.

In such situation, detach_tasks returns immediately and lets the flag
LBF_ALL_PINNED set. The busiest CPU is then wrongly assumed to have pinned
tasks and removed from the load balance mask. then, we redo a load balance
without the busiest CPU. This creates wrong load balance situation and
generates wrong task migration.

If the calculated imbalance is null, it's useless to try to find a busiest
rq as no task will be migrated and we can return immediately.

This situation can happen with heterogeneous system or smp system when RT
tasks are decreasing the capacity of some CPUs.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 309c93f..224bfae 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8464,7 +8464,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
 	}
 
 	group = find_busiest_group(&env);
-	if (!group) {
+	if (!group || !env.imbalance) {
 		schedstat_inc(sd->lb_nobusyg[idle]);
 		goto out_balanced;
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-09-10 10:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-07  7:51 [PATCH] sched/fair: fix load_balance redo for null imbalance Vincent Guittot
2018-09-07 11:37 ` Peter Zijlstra
2018-09-07 12:35   ` Vincent Guittot
2018-09-07 12:55     ` Peter Zijlstra
2018-09-07 12:57       ` Peter Zijlstra
2018-09-07 13:08       ` Vincent Guittot
2018-09-07 12:55     ` Vincent Guittot
2018-09-10 10:08 ` [tip:sched/core] sched/fair: Fix load_balance redo for !imbalance tip-bot for Vincent Guittot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox