From: Morten Rasmussen <morten.rasmussen@arm.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Matt Fleming <matt@codeblueprint.co.uk>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Wanpeng Li <kernellwp@gmail.com>, Yuyang Du <yuyang.du@intel.com>,
Mike Galbraith <umgwanakikbuti@gmail.com>
Subject: Re: [PATCH 2/2 v2] sched: use load_avg for selecting idlest group
Date: Wed, 30 Nov 2016 14:23:24 +0000 [thread overview]
Message-ID: <20161130142323.GE1716@e105550-lin.cambridge.arm.com> (raw)
In-Reply-To: <CAKfTPtBMeL9Omvj+KzL2KAhTH8rjz5BzPypaj6DmCXn0ykZpWg@mail.gmail.com>
On Wed, Nov 30, 2016 at 02:49:11PM +0100, Vincent Guittot wrote:
> On 30 November 2016 at 13:49, Morten Rasmussen <morten.rasmussen@arm.com> wrote:
> > On Fri, Nov 25, 2016 at 04:34:33PM +0100, Vincent Guittot wrote:
> >> find_idlest_group() only compares the runnable_load_avg when looking for
> >> the least loaded group. But on fork intensive use case like hackbench
>
> [snip]
>
> >> + min_avg_load = avg_load;
> >> + idlest = group;
> >> + } else if ((runnable_load < (min_runnable_load + imbalance)) &&
> >> + (100*min_avg_load > imbalance_scale*avg_load)) {
> >> + /*
> >> + * The runnable loads are close so we take
> >> + * into account blocked load through avg_load
> >> + * which is blocked + runnable load
> >> + */
> >> + min_avg_load = avg_load;
> >> idlest = group;
> >> }
> >>
> >> @@ -5470,13 +5495,16 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
> >> goto no_spare;
> >>
> >> if (this_spare > task_util(p) / 2 &&
> >> - imbalance*this_spare > 100*most_spare)
> >> + imbalance_scale*this_spare > 100*most_spare)
> >> return NULL;
> >> else if (most_spare > task_util(p) / 2)
> >> return most_spare_sg;
> >>
> >> no_spare:
> >> - if (!idlest || 100*this_load < imbalance*min_load)
> >> + if (!idlest ||
> >> + (min_runnable_load > (this_runnable_load + imbalance)) ||
> >> + ((this_runnable_load < (min_runnable_load + imbalance)) &&
> >> + (100*min_avg_load > imbalance_scale*this_avg_load)))
> >
> > I don't get why you have imbalance_scale applied to this_avg_load and
> > not min_avg_load. IIUC, you end up preferring non-local groups?
>
> In fact, I have keep the same condition that is used when looping the group.
The logic is inverted compared to the group loop as there you after
picking a better group. There it makes sense that you accept groups with
a slightly higher runnable_load if they have a much better avg_load.
Here you are after rejecting 'idlest' group if it isn't significantly
better than the local group, so the conditions have to be inverted.
> You're right that we should prefer local rq if avg_load are close and
> test the condition
> (100*this_avg_load > imbalance_scale*min_avg_load) instead
I would argue you should switch the inequality operator around:
(100*this_avg_load < imbalance_scale*min_avg_load)
So it becomes true unless min_avg_load is significantly less than
this_avg_load meaning that we will ignore 'idlest' and return NULL. This
is also in line with old condition (100*this_load < imbalance*min_load).
> >
> > If we take the example where this_runnable_load == min_runnable_load and
> > this_avg_load == min_avg_load. In this case, and in cases where
> > min_avg_load is slightly bigger than this_avg_load, we end up picking
> > the 'idlest' group even if the local group is equally good or even
> > slightly better?
> >
> >> return NULL;
> >> return idlest;
> >> }
> >
> > Overall, I like that load_avg is being brought in to make better
> > decisions. The variable naming is a bit confusing. For example,
> > runnable_load is a capacity-average just like avg_load. 'imbalance' is
> > now an absolute capacity-average margin, but it is hard to come up with
> > better short alternatives.
> >
> > Although 'imbalance' is based on the existing imbalance_pct, I find
> > somewhat arbitrary. Why is (imbalance_pct-100)*1024/100 a good absolute
> > margin to define the interval where we want to consider load_avg? I
> > guess it is case of 'we had to pick some value', which we have done in
> > many other places. Though, IMHO, it is a bit strange that imbalance_pct
> > is used in two different ways to bias comparison in the same function.
>
> I see imbalance_pct like the definition of the acceptable imbalance %
> for a sched_domain. This % is then used against the current load or to
> define an absolute value.
>
> > It used to be only used as a scaling factor (now imbalance_scale), while
> > this patch proposes to use it for computing an absolute margin
> > (imbalance) as well. It is not major issue, but it is not clear why it
> > is used differently to compare two metrics that are relatively closely
> > related.
>
> In fact, scaling factor (imbalance) doesn't work well with small
> value. As an example, the use of a scaling factor fails as soon as
> this_runnable_load = 0 because we always selected local rq even if
> min_runnable_load is only 1 which doesn't really make sense because
> they are just the same.
Agreed, using the operator for scaling is not ideal for low load
scenarios. The spare-capacity checking is fixing that issue for some
scenarios but not all.
Could we mention these points somewhere so people can be reminded later?
In the commit message, if not as a comment in the code?
next prev parent reply other threads:[~2016-11-30 14:23 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-25 15:34 [PATCH 0/2 v2] sched: improve spread of tasks during fork Vincent Guittot
2016-11-25 15:34 ` [PATCH 1/2 v2] sched: fix find_idlest_group for fork Vincent Guittot
2016-11-28 17:01 ` Matt Fleming
2016-11-28 17:20 ` Vincent Guittot
2016-11-29 10:57 ` Morten Rasmussen
2016-11-29 11:42 ` Peter Zijlstra
2016-11-29 11:44 ` Matt Fleming
2016-11-29 12:30 ` Peter Zijlstra
2016-11-29 14:46 ` Morten Rasmussen
2016-12-05 8:48 ` Peter Zijlstra
2016-11-29 13:04 ` Vincent Guittot
2016-11-29 14:50 ` Morten Rasmussen
2016-11-29 14:57 ` Vincent Guittot
2016-12-03 23:25 ` Matt Fleming
2016-12-05 9:17 ` Vincent Guittot
2016-11-25 15:34 ` [PATCH 2/2 v2] sched: use load_avg for selecting idlest group Vincent Guittot
2016-11-30 12:49 ` Morten Rasmussen
2016-11-30 13:49 ` Vincent Guittot
2016-11-30 13:54 ` Vincent Guittot
2016-11-30 14:24 ` Morten Rasmussen
2016-12-02 15:20 ` Vincent Guittot
2016-12-02 22:24 ` Matt Fleming
2016-11-30 14:23 ` Morten Rasmussen [this message]
2016-12-03 3:31 ` Brendan Gregg
2016-12-03 21:47 ` Matt Fleming
2016-12-05 9:27 ` Vincent Guittot
2016-12-05 13:35 ` Matt Fleming
2016-12-08 14:09 ` Matt Fleming
2016-12-08 14:33 ` Vincent Guittot
2016-11-28 17:02 ` [PATCH 0/2 v2] sched: improve spread of tasks during fork Matt Fleming
2016-11-28 17:20 ` Vincent Guittot
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=20161130142323.GE1716@e105550-lin.cambridge.arm.com \
--to=morten.rasmussen@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=kernellwp@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=umgwanakikbuti@gmail.com \
--cc=vincent.guittot@linaro.org \
--cc=yuyang.du@intel.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
all inboxes | Powered by JetHome®