From: Peter Zijlstra <peterz@infradead.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Dimitri Sivanich <sivanich@sgi.com>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [patch 1/2] sched, timers: move calc_load() to scheduler
Date: Fri, 15 May 2009 07:13:11 +0200 [thread overview]
Message-ID: <1242364391.26820.49.camel@twins> (raw)
In-Reply-To: <alpine.LFD.2.00.0905142224230.3561@localhost.localdomain>
On Thu, 2009-05-14 at 22:40 +0200, Thomas Gleixner wrote:
> On Thu, 14 May 2009, Peter Zijlstra wrote:
> > On Thu, 2009-05-14 at 11:21 +0000, Thomas Gleixner wrote:
> > > plain text document attachment (move-calc-load-to-scheduler-v1.patch)
> >
> > > +/*
> > > + * calc_load - update the avenrun load estimates 10 ticks after the
> > > + * CPUs have updated calc_load_tasks.
> > > + */
> > > +void calc_global_load(void)
> > > +{
> > > + unsigned long upd = calc_load_update + 10;
> > > + long active;
> > > +
> > > + if (time_before(jiffies, upd))
> > > + return;
> > >
> > > + active = atomic_long_read(&calc_load_tasks);
> > > + active = active > 0 ? active * FIXED_1 : 0;
> > >
> > > + avenrun[0] = calc_load(avenrun[0], EXP_1, active);
> > > + avenrun[1] = calc_load(avenrun[1], EXP_5, active);
> > > + avenrun[2] = calc_load(avenrun[2], EXP_15, active);
> > > +
> > > + calc_load_update += LOAD_FREQ;
> > > +}
> >
> > > @@ -1211,7 +1160,8 @@ static inline void update_times(unsigned
> > > void do_timer(unsigned long ticks)
> > > {
> > > jiffies_64 += ticks;
> > > - update_times(ticks);
> > > + update_wall_time();
> > > + calc_global_load();
> > > }
> >
> > I can see multiple cpus fall into calc_global_load() concurrently, which
> > would 'age' the load faster than expected.
> >
> > Should we plug that hole?
>
> They can't. do_timer() is called by exactly one CPU under xtime
> lock. What we removed is the loop over all online CPUs to retrieve the
> number of active tasks.
Ah, D'0h, yes.
Patches look good then.
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
next prev parent reply other threads:[~2009-05-15 5:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 11:21 [patch 0/2] sched, timers: simplify calc_load and avoid cpu iteration loop Thomas Gleixner
2009-05-14 11:21 ` [patch 1/2] sched, timers: move calc_load() to scheduler Thomas Gleixner
2009-05-14 20:00 ` Peter Zijlstra
2009-05-14 20:40 ` Thomas Gleixner
2009-05-15 5:13 ` Peter Zijlstra [this message]
2009-05-14 11:21 ` [patch 2/2] sched, timers: cleanup avenrun users Thomas Gleixner
2009-05-14 17:23 ` [patch 0/2] sched, timers: simplify calc_load and avoid cpu iteration loop Dimitri Sivanich
2009-05-14 19:26 ` Thomas Gleixner
2009-05-15 12:23 ` Dimitri Sivanich
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=1242364391.26820.49.camel@twins \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sivanich@sgi.com \
--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