Commit f9d21ae7 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] sched: use for_each_cpu

The per cpu schedule counters need to be summed up over all possible cpus. 
When testing hotplug cpu remove I saw the sum of the online cpu count for
nr_uninterruptible go negative which made the load average go nuts.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f059989b
...@@ -1095,7 +1095,7 @@ unsigned long nr_uninterruptible(void) ...@@ -1095,7 +1095,7 @@ unsigned long nr_uninterruptible(void)
{ {
unsigned long i, sum = 0; unsigned long i, sum = 0;
for_each_online_cpu(i) for_each_cpu(i)
sum += cpu_rq(i)->nr_uninterruptible; sum += cpu_rq(i)->nr_uninterruptible;
return sum; return sum;
...@@ -1105,7 +1105,7 @@ unsigned long long nr_context_switches(void) ...@@ -1105,7 +1105,7 @@ unsigned long long nr_context_switches(void)
{ {
unsigned long long i, sum = 0; unsigned long long i, sum = 0;
for_each_online_cpu(i) for_each_cpu(i)
sum += cpu_rq(i)->nr_switches; sum += cpu_rq(i)->nr_switches;
return sum; return sum;
...@@ -1115,7 +1115,7 @@ unsigned long nr_iowait(void) ...@@ -1115,7 +1115,7 @@ unsigned long nr_iowait(void)
{ {
unsigned long i, sum = 0; unsigned long i, sum = 0;
for_each_online_cpu(i) for_each_cpu(i)
sum += atomic_read(&cpu_rq(i)->nr_iowait); sum += atomic_read(&cpu_rq(i)->nr_iowait);
return sum; return sum;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment