mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: 王贇 <yun.wang@linux.alibaba.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	"open list:SCHEDULER" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched: avoid scale real weight down to zero
Date: Wed, 11 Mar 2020 11:12:07 +0800	[thread overview]
Message-ID: <63631321-3e25-913e-a061-9ff65c98b76b@linux.alibaba.com> (raw)
In-Reply-To: <CAKfTPtAt43DOT2AnRLyO5tqxDGhaCqFKOc1Ws+WSt2NLtGQ9UQ@mail.gmail.com>

On 2020/3/6 下午11:06, Vincent Guittot wrote:
[snip]
>>
>> Thus when scale_load_down() scale real weight down to 0, it's no
>> longer telling the real story, the caller will have the wrong
>> information and the calculation will be buggy.
>>
>> This patch add check in scale_load_down(), so the real weight will
>> be >= MIN_SHARES after scale, after applied the group C wins as
>> expected.
>>
>> Cc: Ben Segall <bsegall@google.com>
>> Cc: Vincent Guittot <vincent.guittot@linaro.org>
>> Suggested-by: Peter Zijlstra <peterz@infradead.org>
>> Signed-off-by: Michael Wang <yun.wang@linux.alibaba.com>
> 
> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>

Thanks for the review :-)

Hi Peter, should we apply this one?

Regards,
Michael Wang


>> ---
>>  kernel/sched/sched.h | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
>> index 2a0caf394dd4..75c283f22256 100644
>> --- a/kernel/sched/sched.h
>> +++ b/kernel/sched/sched.h
>> @@ -118,7 +118,13 @@ extern long calc_load_fold_active(struct rq *this_rq, long adjust);
>>  #ifdef CONFIG_64BIT
>>  # define NICE_0_LOAD_SHIFT     (SCHED_FIXEDPOINT_SHIFT + SCHED_FIXEDPOINT_SHIFT)
>>  # define scale_load(w)         ((w) << SCHED_FIXEDPOINT_SHIFT)
>> -# define scale_load_down(w)    ((w) >> SCHED_FIXEDPOINT_SHIFT)
>> +# define scale_load_down(w) \
>> +({ \
>> +       unsigned long __w = (w); \
>> +       if (__w) \
>> +               __w = max(MIN_SHARES, __w >> SCHED_FIXEDPOINT_SHIFT); \
>> +       __w; \
>> +})
>>  #else
>>  # define NICE_0_LOAD_SHIFT     (SCHED_FIXEDPOINT_SHIFT)
>>  # define scale_load(w)         (w)
>> --
>> 2.14.4.44.g2045bb6
>>

  reply	other threads:[~2020-03-11  3:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05  2:57 王贇
2020-03-06 15:06 ` Vincent Guittot
2020-03-11  3:12   ` 王贇 [this message]
2020-03-16  6:33 ` 王贇

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=63631321-3e25-913e-a061-9ff65c98b76b@linux.alibaba.com \
    --to=yun.wang@linux.alibaba.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    /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®