percpu_counters: use for_each_online_cpu()
authorAndrew Morton <akpm@linux-foundation.org>
Mon, 16 Jul 2007 06:39:51 +0000 (23:39 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 16 Jul 2007 16:05:41 +0000 (09:05 -0700)
Now that we have implemented hotunplug-time counter spilling,
percpu_counter_sum() only needs to look at online CPUs.

Cc: Gautham R Shenoy <ego@in.ibm.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/percpu_counter.c

index 8901c4e..cf22c61 100644 (file)
@@ -45,7 +45,7 @@ s64 percpu_counter_sum(struct percpu_counter *fbc)
 
        spin_lock(&fbc->lock);
        ret = fbc->count;
-       for_each_possible_cpu(cpu) {
+       for_each_online_cpu(cpu) {
                s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
                ret += *pcount;
        }