mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@linaro.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched/fair: refine maximum periods for decay_load
Date: Fri, 5 Aug 2016 16:17:02 +0800	[thread overview]
Message-ID: <20160805081702.GA21369@leoy-linaro> (raw)
In-Reply-To: <CAKfTPtDHWjVB+2Tqmr2eD7kHjDjd+54PbU4A93oDpvVgHz4jGg@mail.gmail.com>

Hi Vincent,

Thanks for review.

On Fri, Aug 05, 2016 at 09:56:46AM +0200, Vincent Guittot wrote:
> Hi Leo,
> 
> On 5 August 2016 at 08:34, Leo Yan <leo.yan@linaro.org> wrote:
> >
> > In current code, decay_load() will consider to set load value to zero
> > after passing 32*64 ms. So this means max_load * (0.5^64) ~= 0.
> >
> > Kernel can support maximum number of processes and threads to 2^29 and
> > set task with highest priority with nice=-20 (weight = 88761). So in
> > worst case, one CPU may have maximum load value is:
> >
> >     max_load = 2^29 * 88761 < 2^46
> >
> > In theory after pass 46 periods we can ensure load value will be decayed
> > to zero. So this patch is to change maximum periods from 64 to 48.
> >
> > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > ---
> >  kernel/sched/fair.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index e342159..55cb134 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -2622,7 +2622,7 @@ static __always_inline u64 decay_load(u64 val, u64 n)
> >
> >         if (!n)
> >                 return val;
> > -       else if (unlikely(n > LOAD_AVG_PERIOD * 63))
> > +       else if (unlikely(n > LOAD_AVG_PERIOD * 47))
> 
> In the equation above, you use 46 then you mentioned : "change maximum
> periods from 64 to 48." and finally you use 47.

Sorry introduce confusion. I want to align to 16 so choose maximum
periods to 48, and due to condition is (n > LOAD_AVG_PERIOD * 47) so
it equeals to (n >= LOAD_AVG_PERIOD * 48).

Precisely I think the code should be:
    else if (unlikely(n >= LOAD_AVG_PERIOD * 46))

Do you think this is okay?

> >                 return 0;
> >
> >         /* after bounds checking we can collapse to 32-bit */
> > --
> > 1.9.1
> >

  reply	other threads:[~2016-08-05  8:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05  6:34 Leo Yan
2016-08-05  7:56 ` Vincent Guittot
2016-08-05  8:17   ` Leo Yan [this message]
2016-08-05  8:31     ` 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=20160805081702.GA21369@leoy-linaro \
    --to=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.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®