linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Guittot <vincent.guittot@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	Morten Rasmussen <Morten.Rasmussen@arm.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Wanpeng Li <kernellwp@gmail.com>,
	yuyang.du@intel.comc, Mike Galbraith <umgwanakikbuti@gmail.com>
Subject: Re: [PATCH 2/2 v3] sched: use load_avg for selecting idlest group
Date: Fri, 9 Dec 2016 17:28:33 +0100	[thread overview]
Message-ID: <CAKfTPtAYJ_6C0=GZJoO-UQz=5GRQuf=6YXVBLvG6pojp9CDEdg@mail.gmail.com> (raw)
In-Reply-To: <20161209152242.GU3124@twins.programming.kicks-ass.net>

On 9 December 2016 at 16:22, Peter Zijlstra <peterz@infradead.org> wrote:
> On Thu, Dec 08, 2016 at 05:56:54PM +0100, Vincent Guittot wrote:
>> @@ -5449,14 +5456,32 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
>>               }
>>
>>               /* Adjust by relative CPU capacity of the group */
>> -             avg_load = (avg_load * SCHED_CAPACITY_SCALE) / group->sgc->capacity;
>> +             avg_load = (avg_load * SCHED_CAPACITY_SCALE) /
>> +                                     group->sgc->capacity;
>> +             runnable_load = (runnable_load * SCHED_CAPACITY_SCALE) /
>> +                                     group->sgc->capacity;
>>
>>               if (local_group) {
>> -                     this_load = avg_load;
>> +                     this_runnable_load = runnable_load;
>> +                     this_avg_load = avg_load;
>>                       this_spare = max_spare_cap;
>>               } else {
>> -                     if (avg_load < min_load) {
>> -                             min_load = avg_load;
>> +                     if (min_runnable_load > (runnable_load + imbalance)) {
>> +                             /*
>> +                              * The runnable load is significantly smaller
>> +                              *  so we can pick this new cpu
>> +                              */
>> +                             min_runnable_load = runnable_load;
>> +                             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;
>>                       }
>>
>> @@ -5480,13 +5505,16 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
>>               goto skip_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;
>>
>>  skip_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*this_avg_load < imbalance_scale*min_avg_load)))
>>               return NULL;
>>       return idlest;
>>  }
>
> I did the below on top for readability.

Changes looks good to me

>
> ---
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5469,17 +5469,16 @@ find_idlest_group(struct sched_domain *s
>                         if (min_runnable_load > (runnable_load + imbalance)) {
>                                 /*
>                                  * The runnable load is significantly smaller
> -                                *  so we can pick this new cpu
> +                                * so we can pick this new cpu
>                                  */
>                                 min_runnable_load = runnable_load;
>                                 min_avg_load = avg_load;
>                                 idlest = group;
>                         } else if ((runnable_load < (min_runnable_load + imbalance)) &&
> -                                       (100*min_avg_load > imbalance_scale*avg_load)) {
> +                                  (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
> +                                * The runnable loads are close so take the
> +                                * blocked load into account through avg_load.
>                                  */
>                                 min_avg_load = avg_load;
>                                 idlest = group;
> @@ -5509,15 +5508,21 @@ find_idlest_group(struct sched_domain *s
>         if (this_spare > task_util(p) / 2 &&
>             imbalance_scale*this_spare > 100*most_spare)
>                 return NULL;
> -       else if (most_spare > task_util(p) / 2)
> +
> +       if (most_spare > task_util(p) / 2)
>                 return most_spare_sg;
>
>  skip_spare:
> -       if (!idlest ||
> -           (min_runnable_load > (this_runnable_load + imbalance)) ||
> -           ((this_runnable_load < (min_runnable_load + imbalance)) &&
> -                       (100*this_avg_load < imbalance_scale*min_avg_load)))
> +       if (!idlest)
> +               return NULL;
> +
> +       if (min_runnable_load > (this_runnable_load + imbalance))
>                 return NULL;
> +
> +       if ((this_runnable_load < (min_runnable_load + imbalance)) &&
> +            (100*this_avg_load < imbalance_scale*min_avg_load))
> +               return NULL;
> +
>         return idlest;
>  }
>

  reply	other threads:[~2016-12-09 16:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-08 16:56 [PATCH 0/2 v3] sched: improve spread of tasks during fork Vincent Guittot
2016-12-08 16:56 ` [PATCH 1/2 v3] sched: fix find_idlest_group for fork Vincent Guittot
2016-12-09 13:18   ` Matt Fleming
2016-12-12  6:50   ` [tip:sched/core] sched/core: Fix find_idlest_group() " tip-bot for Vincent Guittot
2016-12-08 16:56 ` [PATCH 2/2 v3] sched: use load_avg for selecting idlest group Vincent Guittot
2016-12-09 13:22   ` Matt Fleming
2016-12-09 15:22   ` Peter Zijlstra
2016-12-09 16:28     ` Vincent Guittot [this message]
2016-12-12  6:51   ` [tip:sched/core] sched/core: Use " tip-bot for 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='CAKfTPtAYJ_6C0=GZJoO-UQz=5GRQuf=6YXVBLvG6pojp9CDEdg@mail.gmail.com' \
    --to=vincent.guittot@linaro.org \
    --cc=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=yuyang.du@intel.comc \
    /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).