From: Rik van Riel <riel@redhat.com>
To: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, morten.rasmussen@arm.com,
mingo@kernel.org, george.mccollister@gmail.com,
ktkhai@parallels.com
Subject: Re: [PATCH] sched: wake up task on prev_cpu if not in SD_WAKE_AFFINE domain with cpu
Date: Fri, 09 May 2014 11:24:54 -0400 [thread overview]
Message-ID: <536CF346.6080009@redhat.com> (raw)
In-Reply-To: <1399649042.31219.47.camel@marge.simpson.net>
On 05/09/2014 11:24 AM, Mike Galbraith wrote:
> On Fri, 2014-05-09 at 10:22 -0400, Rik van Riel wrote:
>> On 05/09/2014 03:34 AM, Mike Galbraith wrote:
>>> On Fri, 2014-05-09 at 01:27 -0400, Rik van Riel wrote:
>>>> On Thu, 08 May 2014 22:20:25 -0400
>>>> Rik van Riel <riel@redhat.com> wrote:
>>>>
>>>>> Looks like SD_BALANCE_WAKE is not gotten from the sd flags at
>>>>> all, but passed into select_task_rq by try_to_wake_up, as a
>>>>> hard coded sd_flags argument.
>>>>
>>>>> Should we do that, if SD_WAKE_BALANCE is not set for any sched domain?
>>>>
>>>> I answered my own question. The sd_flag SD_WAKE_BALANCE simply means
>>>> "this is a wakeup of a previously existing task, please place it
>>>> properly".
>>>>
>>>> However, it appears that the current code will fall back to the large
>>>> loop with select_idlest_group and friends, if prev_cpu and cpu are not
>>>> part of the same SD_WAKE_AFFINE sched domain. That is a bug...
>>>
>>> ttwu(): cpu = select_task_rq(p, p->wake_cpu, SD_BALANCE_WAKE, wake_flags);
>>>
>>> We pass SD_BALANCE_WAKE for a normal wakeup, so sd will only be set if
>>> we encounter a domain during traversal where Joe User has told us to do
>>> (expensive) wake balancing before we hit a domain shared by waker/wakee.
>>>
>>> The user can turn SD_WAKE_AFFINE off beyond socket, and we'll not pull
>>> cross node on wakeup.
>>>
>>> Or, you could create an override button to say despite SD_WAKE_AFFINE
>>> perhaps having been set during domain construction (because of some
>>> pseudo-random numbers), don't do that if we have a preferred node, or
>>> just make that automatically part of having numa scheduling enabled, and
>>> don't bother wasting cycles if preferred && this != preferred.
>>
>> That's not the problem.
>>
>> The problem is that if we do not do an affine wakeup, due to
>> SD_WAKE_AFFINE not being set on a top level domain, we will
>> not try to run p on prev_cpu, but we will fall through into
>> the loop with find_idlest_group, etc...
>
> If no ->flags & SD_BALANCE_WAKE is encountered during traversal, sd
> remains NULL, we fall through to return prev_cpu.
We do fall through, but into this loop:
while (sd) {
struct sched_group *group;
int weight;
if (!(sd->flags & sd_flag)) {
sd = sd->child;
continue;
}
group = find_idlest_group(sd, p, cpu, sd_flag);
if (!group) {
sd = sd->child;
continue;
}
new_cpu = find_idlest_cpu(group, p, cpu);
if (new_cpu == -1 || new_cpu == cpu) {
/* Now try balancing at a lower domain level of
cpu */
sd = sd->child;
continue;
}
/* Now try balancing at a lower domain level of new_cpu */
cpu = new_cpu;
weight = sd->span_weight;
sd = NULL;
for_each_domain(cpu, tmp) {
if (weight <= tmp->span_weight)
break;
if (tmp->flags & sd_flag)
sd = tmp;
}
/* while loop will break here if sd == NULL */
}
next prev parent reply other threads:[~2014-05-09 15:28 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-02 4:42 [PATCH RFC/TEST] sched: make sync affine wakeups work Rik van Riel
2014-05-02 5:32 ` Mike Galbraith
2014-05-02 5:41 ` Mike Galbraith
2014-05-02 5:58 ` Mike Galbraith
2014-05-02 6:08 ` Rik van Riel
2014-05-02 6:36 ` Mike Galbraith
2014-05-02 6:51 ` Mike Galbraith
2014-05-02 6:13 ` Mike Galbraith
2014-05-02 6:30 ` Rik van Riel
2014-05-02 7:37 ` Mike Galbraith
2014-05-02 10:56 ` Rik van Riel
2014-05-02 11:27 ` Mike Galbraith
2014-05-02 12:51 ` Mike Galbraith
[not found] ` <5363B793.9010208@redhat.com>
2014-05-06 11:54 ` Peter Zijlstra
2014-05-06 20:19 ` Rik van Riel
2014-05-06 20:39 ` Peter Zijlstra
2014-05-06 23:46 ` Rik van Riel
2014-05-09 2:20 ` Rik van Riel
2014-05-09 5:27 ` [PATCH] sched: wake up task on prev_cpu if not in SD_WAKE_AFFINE domain with cpu Rik van Riel
2014-05-09 6:04 ` [PATCH] sched: clean up select_task_rq_fair conditionals and indentation Rik van Riel
2014-05-09 7:34 ` [PATCH] sched: wake up task on prev_cpu if not in SD_WAKE_AFFINE domain with cpu Mike Galbraith
2014-05-09 14:22 ` Rik van Riel
2014-05-09 15:24 ` Mike Galbraith
2014-05-09 15:24 ` Rik van Riel [this message]
2014-05-09 17:55 ` Mike Galbraith
2014-05-09 18:16 ` Rik van Riel
2014-05-10 3:54 ` Mike Galbraith
2014-05-13 14:08 ` Rik van Riel
2014-05-14 4:08 ` Mike Galbraith
2014-05-14 15:40 ` [PATCH] sched: call select_idle_sibling when not affine_sd Rik van Riel
2014-05-14 15:45 ` Peter Zijlstra
2014-05-19 13:08 ` [tip:sched/core] " tip-bot for Rik van Riel
2014-05-22 12:27 ` [tip:sched/core] sched: Call select_idle_sibling() " tip-bot for Rik van Riel
2014-05-04 11:44 ` [PATCH RFC/TEST] sched: make sync affine wakeups work Preeti Murthy
2014-05-04 12:04 ` Mike Galbraith
2014-05-05 4:38 ` Preeti U Murthy
2014-05-04 12:41 ` Rik van Riel
2014-05-05 4:50 ` Preeti U Murthy
2014-05-05 6:43 ` Preeti U Murthy
2014-05-05 11:28 ` Rik van Riel
2014-05-06 13:26 ` Peter Zijlstra
2014-05-06 13:25 ` Peter Zijlstra
2014-05-06 20:20 ` Rik van Riel
2014-05-06 20:41 ` Peter Zijlstra
2014-05-07 12:17 ` Ingo Molnar
2014-05-06 11:56 ` Peter Zijlstra
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=536CF346.6080009@redhat.com \
--to=riel@redhat.com \
--cc=george.mccollister@gmail.com \
--cc=ktkhai@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=morten.rasmussen@arm.com \
--cc=peterz@infradead.org \
--cc=umgwanakikbuti@gmail.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;
as well as URLs for NNTP newsgroup(s).