From: Peter Zijlstra <peterz@infradead.org>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: byungchul.park@lge.com, mingo@kernel.org,
linux-kernel@vger.kernel.org, tglx@linutronix.de
Subject: Re: [RESEND PATCH] sched: consider missed ticks when updating global cpu load
Date: Wed, 30 Sep 2015 12:43:43 +0200 [thread overview]
Message-ID: <20150930104343.GE2881@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20150926131444.GA5507@lerouge>
On Sat, Sep 26, 2015 at 03:14:45PM +0200, Frederic Weisbecker wrote:
> > when the next tick occurs, update_process_times() -> scheduler_tick()
> > -> update_cpu_load_active() is performed, assuming the distance between
> > last tick and current tick is 1 tick! it's wrong in this case. thus,
> > this abnormal case should be considered in update_cpu_load_active().
> >
> > Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> > ---
> > kernel/sched/fair.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 4d5f97b..829282f 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -4356,12 +4356,15 @@ void update_cpu_load_nohz(void)
> > */
> > void update_cpu_load_active(struct rq *this_rq)
> > {
> > + unsigned long curr_jiffies = READ_ONCE(jiffies);
> > + unsigned long pending_updates;
> > unsigned long load = weighted_cpuload(cpu_of(this_rq));
> > /*
> > * See the mess around update_idle_cpu_load() / update_cpu_load_nohz().
> > */
> > - this_rq->last_load_update_tick = jiffies;
> > - __update_cpu_load(this_rq, load, 1);
> > + pending_updates = curr_jiffies - this_rq->last_load_update_tick;
> > + this_rq->last_load_update_tick = curr_jiffies;
> > + __update_cpu_load(this_rq, load, pending_updates);
> > }
>
> That's right but __update_cpu_load() doesn't handle correctly pending updates
> with non-zero loads. Currently, pending updates are wheeled through decay_load_missed()
> that assume it's all about idle load.
>
> But in the cases you've enumerated, as well as in the nohz full case, missed pending
> updates can be about buzy loads.
>
> I think we need to fix update_cpu_load() to handle that first, or your fix is
> going to make things worse.
Its worse than that, the whole call chain of update_process_times()
fully assumes a single tick, fixing just the one function deep down to
handle more than 1 tick is ass backwards.
next prev parent reply other threads:[~2015-09-30 10:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 8:52 [RESEND PATCH] sched: consider missed ticks when updating global cpu load byungchul.park
2015-09-26 13:14 ` Frederic Weisbecker
2015-09-30 10:43 ` Peter Zijlstra [this message]
2015-10-02 1:04 ` Byungchul Park
2015-10-02 0:43 ` Byungchul Park
2015-10-02 1:25 ` Byungchul Park
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=20150930104343.GE2881@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=byungchul.park@lge.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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