Re: [PATCH] - Reduce overhead of calc_load
From: Andrew Morton
Date: Fri Mar 17 2006 - 21:41:44 EST
Nick Piggin <nickpiggin@xxxxxxxxxxxx> wrote:
>
> > 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.
> >
>
> Is there a need? Do they (except calc_load) use multiple values at
> the same time?
Don't know. It might happen in the future. And the additional cost is
practically zero.
> > And then give get_sched_stuff() a hotplug handler (probably unneeded) and
>
> What would the hotplug handler do?
Move the stats from the going-away CPU into the current CPU's runqueue.
> > 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().
> >
>
> I think it need only iterate over possible CPUs.
Someone who has four online CPUs, sixteen present CPUs and 128 possible
CPUs would be justifiably disappointed, no?
> >
> > IOW: this code's an inefficient mess and needs some caring for.
>
> What are the performance critical places that call the nr_blah() functions?
>
That depends upon the frequency with which userspace reads /proc/loadavg,
/proc/stat or /proc/future-stuff.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/