public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <andrea@betterlinux.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Menage <paul@paulmenage.org>, Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2 1/3] sched: introduce distinct per-cpu load average
Date: Mon, 22 Oct 2012 13:46:57 +0200	[thread overview]
Message-ID: <20121022114657.GA32659@thinkpad> (raw)
In-Reply-To: <1350904240.2768.95.camel@twins>

On Mon, Oct 22, 2012 at 01:10:40PM +0200, Peter Zijlstra wrote:
> On Sat, 2012-10-20 at 21:06 +0200, Andrea Righi wrote:
> > @@ -383,13 +383,7 @@ struct rq {
> >         struct list_head leaf_rt_rq_list;
> >  #endif
> >  
> 
> > +       unsigned long __percpu *nr_uninterruptible; 
> 
> This is O(nr_cpus^2) memory..
> 

Correct, this doesn't add too much overhead to the wakeup/sleep path,
but it's bad both in terms of memory and performance overhead in the
other parts of the code for large SMP systems.

> 
> > +unsigned long nr_uninterruptible_cpu(int cpu)
> > +{
> > +       struct rq *this = cpu_rq(cpu);
> > +       unsigned long val = 0;
> > +       int i;
> > +
> > +       for_each_online_cpu(i)
> > +               val += per_cpu(*this->nr_uninterruptible, i);
> > +
> > +       return val;
> > +}
> > 
> > 
> I suspect you've got an accounting leak here on hot-plug.

And I think you're right about the accounting leak with cpu hotplug.
I'll do more tests with this part, until I come up with a better idea
in general for the nr_uninterruptible accounting.

Thanks!
-Andrea

> > 
> >  unsigned long nr_uninterruptible(void)
> >  {
> >         unsigned long i, sum = 0;
> >  
> >         for_each_possible_cpu(i)
> > -               sum += cpu_rq(i)->nr_uninterruptible;
> > +               sum += nr_uninterruptible_cpu(i);
> >  
> >         /*
> >          * Since we read the counters lockless, it might be slightly
> 
> And this makes O(n^2) runtime!
> 

  reply	other threads:[~2012-10-22 11:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20 19:05 [PATCH v2 0/3] distinct load average per-cpuset Andrea Righi
2012-10-20 19:06 ` [PATCH v2 1/3] sched: introduce distinct per-cpu load average Andrea Righi
2012-10-22 11:10   ` Peter Zijlstra
2012-10-22 11:46     ` Andrea Righi [this message]
2012-10-20 19:06 ` [PATCH v2 2/3] cpusets: add load avgerage interface Andrea Righi
2012-10-20 19:06 ` [PATCH v2 3/3] cpusets: add documentation of the loadavg file Andrea Righi
2013-07-18 10:34 ` [PATCH v2 0/3] distinct load average per-cpuset Ozan Çağlayan

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=20121022114657.GA32659@thinkpad \
    --to=andrea@betterlinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paul@paulmenage.org \
    --cc=peterz@infradead.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