From: Peter Zijlstra <peterz@infradead.org>
To: Xunlei Pang <xlpang@126.com>
Cc: linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Juri Lelli <juri.lelli@gmail.com>,
Xunlei Pang <pang.xunlei@linaro.org>
Subject: Re: [PATCH] sched/fair: Restore env status before goto redo in load_balance()
Date: Fri, 27 Mar 2015 16:30:23 +0100 [thread overview]
Message-ID: <20150327153023.GG23123@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1426660262-27526-1-git-send-email-xlpang@126.com>
On Wed, Mar 18, 2015 at 02:31:02PM +0800, Xunlei Pang wrote:
> From: Xunlei Pang <pang.xunlei@linaro.org>
>
> In load_balance(), some members of lb_env will be assigned with
> new values in LBF_DST_PINNED case. But lb_env::flags may still
> retain LBF_ALL_PINNED if no proper tasks were found afterwards
> due to another balance, task affinity changing, etc, which can
> really happen because busiest rq lock has already been released.
Sure..
> This is wrong, for example with env.dst_cpu assigned new_dst_cpu
> when going back to "redo" label, it may cause should_we_balance()
> to return false which is unreasonable.
Why? You've got a very unlikely, very hard case, its unlikely that
anything we do will substantially improve the situation, but you make
the code uglier for it.
> This patch restores proper status of env before "goto redo", and
> improves "out_all_pinned" and "out_one_pinned" labels.
That doesn't even begin to explain half of what the patch does.
> @@ -6977,12 +6978,19 @@ more_balance:
> /* All tasks on this runqueue were pinned by CPU affinity */
> if (unlikely(env.flags & LBF_ALL_PINNED)) {
> cpumask_clear_cpu(cpu_of(busiest), cpus);
> - if (!cpumask_empty(cpus)) {
> - env.loop = 0;
> - env.loop_break = sched_nr_migrate_break;
> - goto redo;
> + if (env.new_dst_cpu != -1) {
I really don't get this, how can this not be?
> + env.new_dst_cpu = -1;
> + cpumask_or(cpus, cpus,
> + sched_group_cpus(sd->groups));
> + cpumask_and(cpus, cpus, cpu_active_mask);
More unexplained magic, why is this right?
The rest of the patch isn't much better.
next prev parent reply other threads:[~2015-03-27 15:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-18 6:31 Xunlei Pang
2015-03-27 14:35 ` Xunlei Pang
2015-03-27 15:30 ` Peter Zijlstra [this message]
2015-04-01 2:49 ` Xunlei Pang
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=20150327153023.GG23123@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=juri.lelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pang.xunlei@linaro.org \
--cc=rostedt@goodmis.org \
--cc=xlpang@126.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome