From: Peter Zijlstra <peterz@infradead.org>
To: Rik van Riel <riel@redhat.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org
Subject: Re: [PATCH,RFC] sched: fix "impossible" load balancing oops
Date: Tue, 25 Aug 2015 12:19:35 +0200 [thread overview]
Message-ID: <20150825101935.GP16853@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20150821142138.57b5a7c3@riellap.home.surriel.com>
On Fri, Aug 21, 2015 at 02:21:22PM -0400, Rik van Riel wrote:
> 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) {
> /*
Right, so real problem 'recently' introduced by:
88b8dac0a14c ("sched: Improve balance_cpu() to consider other cpus in its group as target of (pinned) task")
But I think there's a wee problem with the solution, if I'm not still
entirely asleep, it appears dst_grpmask might be NULL in case of
CPU_NEWLY_IDLE, which would make that cpumask_clear_cpu() do something
naughty.
next prev parent reply other threads:[~2015-08-25 10:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 18:21 [PATCH,RFC] sched: fix "impossible" load balancing oops Rik van Riel
2015-08-25 10:19 ` Peter Zijlstra [this message]
2015-08-25 18:03 ` Rik van Riel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150825101935.GP16853@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.