public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH,RFC] sched: fix "impossible" load balancing oops
@ 2015-08-21 18:21 Rik van Riel
  2015-08-25 10:19 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Rik van Riel @ 2015-08-21 18:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: peterz, mingo

The load balancing code can run into the situation where
the source and destination runqueues are the same, in
the active balancing code.

        /*
         * This condition is "impossible", if it occurs
         * we need to fix it. Originally reported by
         * Bjorn Helgaas on a 128-cpu setup.
         */
        BUG_ON(busiest_rq == target_rq);

This happens despite not triggering the BUG_ON(busiest == env.dst_rq)
line after find_busiest_queue.

>From code inspection, it appears there is a condition where this can happen.

Specifically, if we encounter only pinned tasks on a CPU, can_migrate_task
will set env->new_dst_cpu to a CPU in the env->dst_grpmask.  If the group
includes the source cpu, we may end up setting env.dst_cpu to the same
as dst.src_cpu.

The fix would be to clear the source cpu from env.dst_grpmask, to ensure
we never select the source cpu as the destination.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 kernel/sched/fair.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d113c3b..514a369 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7172,6 +7172,8 @@ redo:
 	env.src_cpu = busiest->cpu;
 	env.src_rq = busiest;
 
+	cpumask_clear_cpu(busiest->cpu, env.dst_grpmask);
+
 	ld_moved = 0;
 	if (busiest->nr_running > 1) {
 		/*

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

end of thread, other threads:[~2015-08-25 18:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-21 18:21 [PATCH,RFC] sched: fix "impossible" load balancing oops Rik van Riel
2015-08-25 10:19 ` Peter Zijlstra
2015-08-25 18:03   ` Rik van Riel

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