From f9d21ae77239647093e15c0239dd9c381cd090a8 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Sun, 1 Aug 2004 20:09:24 -0700 Subject: [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: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/sched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kernel') diff --git a/kernel/sched.c b/kernel/sched.c index c279ba227145..3e8897919924 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -1095,7 +1095,7 @@ unsigned long nr_uninterruptible(void) { unsigned long i, sum = 0; - for_each_online_cpu(i) + for_each_cpu(i) sum += cpu_rq(i)->nr_uninterruptible; return sum; @@ -1105,7 +1105,7 @@ unsigned long long nr_context_switches(void) { unsigned long long i, sum = 0; - for_each_online_cpu(i) + for_each_cpu(i) sum += cpu_rq(i)->nr_switches; return sum; @@ -1115,7 +1115,7 @@ unsigned long nr_iowait(void) { unsigned long i, sum = 0; - for_each_online_cpu(i) + for_each_cpu(i) sum += atomic_read(&cpu_rq(i)->nr_iowait); return sum; -- cgit v1.2.3