Re: check cpu_online() in nr_running()

From: William Lee Irwin III (wli@holomorphy.com)
Date: Tue Feb 25 2003 - 12:51:55 EST


On Tue, 2003-02-25 at 16:33, William Lee Irwin III wrote:
>> for (i = 0; i < NR_CPUS; i++)
>> + if (!cpu_online(i))
>> + continue;
>> sum += cpu_rq(i)->nr_running;

On Tue, Feb 25, 2003 at 06:32:43PM +0000, Alan Cox wrote:
> I smell donkey poo 8)

I don't really like how this stuff got arranged either.

On Tue, Feb 25, 2003 at 06:32:43PM +0000, Alan Cox wrote:
> If the change is right, which seems reasonable then I think you
> need some { } 's too. Its also a hot path so it may be a lot
> cleaner to keep the jump out of this by just letting
> nr_running be zero for other processors ?

AFAICT its only usages are in /proc/ reporting and loadavg calculation,
which aren't hotpaths per-se, but shouldn't explode in complexity.
Similar things could be said for nr_uninterruptible() and nr_iowait(),
but some kind of unusual constraint is involved wrt. hotplug.

-- wli
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Feb 28 2003 - 22:00:29 EST