From: Andrew Morton <akpm@osdl.org>
To: Jack Steiner <steiner@sgi.com>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] - Reduce overhead of calc_load
Date: Fri, 17 Mar 2006 17:15:38 -0800 [thread overview]
Message-ID: <20060317171538.3826eb41.akpm@osdl.org> (raw)
In-Reply-To: <20060317152611.GA4449@sgi.com>
Jack Steiner <steiner@sgi.com> wrote:
>
> +unsigned long nr_active(void)
> +{
> + unsigned long i, running = 0, uninterruptible = 0;
> +
> + for_each_online_cpu(i) {
> + running += cpu_rq(i)->nr_running;
> + uninterruptible += cpu_rq(i)->nr_uninterruptible;
> + }
> +
> + if (unlikely((long)uninterruptible < 0))
> + uninterruptible = 0;
> +
> + return running + uninterruptible;
> +}
Is that check for (uninterruptible < 0) (copied from nr_uninterruptible)
really needed? Can rq->nr_uninterruptible actually go negative?
Perhaps nr_context_switches() and nr_iowait() should also go into this
function, then we rename it all to
struct sched_stuff {
unsigned nr_uninterruptible;
unsigned nr_running;
unsigned nr_active;
unsigned long nr_context_switches;
};
void get_sched_stuff(struct sched_stuff *);
and then convert all those random little counter-upper-callers we have.
And then give get_sched_stuff() a hotplug handler (probably unneeded) and
then scratch our heads over why nr_uninterruptible() iterates across all
possible CPUs while this new nr_active() iterates over all online CPUs like
nr_running() and unlike nr_context_switches().
IOW: this code's an inefficient mess and needs some caring for.
next prev parent reply other threads:[~2006-03-18 1:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-17 14:57 Jack Steiner
2006-03-17 14:59 ` Ingo Molnar
2006-03-17 15:26 ` Jack Steiner
2006-03-18 1:15 ` Andrew Morton [this message]
2006-03-18 2:09 ` Nick Piggin
2006-03-18 2:37 ` Andrew Morton
2006-03-18 2:46 ` Nick Piggin
2006-03-18 5:13 ` Andrew Morton
2006-03-18 5:38 ` Nick Piggin
2006-03-18 6:10 ` Nick Piggin
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=20060317171538.3826eb41.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=steiner@sgi.com \
/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®