* check cpu_online() in nr_running()
@ 2003-02-25 16:33 William Lee Irwin III
2003-02-25 18:32 ` Alan Cox
0 siblings, 1 reply; 3+ messages in thread
From: William Lee Irwin III @ 2003-02-25 16:33 UTC (permalink / raw)
To: linux-kernel
nr_uninterruptible() and nr_iowait() both check cpu_online(cpu) as
cpu ranges from 0 to NR_CPUS-1; so should nr_running().
-- wli
diff -urpN linux-2.5.63/kernel/sched.c nr_running-2.5.63-1/kernel/sched.c
--- linux-2.5.63/kernel/sched.c Thu Feb 20 20:33:52 2003
+++ nr_running-2.5.63-1/sched.c Tue Feb 25 08:23:09 2003
@@ -637,6 +637,8 @@
unsigned long i, sum = 0;
for (i = 0; i < NR_CPUS; i++)
+ if (!cpu_online(i))
+ continue;
sum += cpu_rq(i)->nr_running;
return sum;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: check cpu_online() in nr_running()
2003-02-25 16:33 check cpu_online() in nr_running() William Lee Irwin III
@ 2003-02-25 18:32 ` Alan Cox
2003-02-25 17:51 ` William Lee Irwin III
0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2003-02-25 18:32 UTC (permalink / raw)
To: William Lee Irwin III; +Cc: Linux Kernel Mailing List
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;
I smell donkey poo 8)
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 ?
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: check cpu_online() in nr_running()
2003-02-25 18:32 ` Alan Cox
@ 2003-02-25 17:51 ` William Lee Irwin III
0 siblings, 0 replies; 3+ messages in thread
From: William Lee Irwin III @ 2003-02-25 17:51 UTC (permalink / raw)
To: Alan Cox; +Cc: Linux Kernel Mailing List
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-02-25 17:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-25 16:33 check cpu_online() in nr_running() William Lee Irwin III
2003-02-25 18:32 ` Alan Cox
2003-02-25 17:51 ` William Lee Irwin III
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®