]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - lib/percpu_counter.c
percpu counter: clean up percpu_counter_sum_and_set()
[linux-2.6-omap-h63xx.git] / lib / percpu_counter.c
index 393a0e915c23b252b747c62645beb463e25843ed..a8663890a88c2e358f21b8cdc6f23a8ebb9d77e5 100644 (file)
@@ -62,7 +62,10 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc)
        for_each_online_cpu(cpu) {
                s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
                ret += *pcount;
+               *pcount = 0;
        }
+       fbc->count = ret;
+
        spin_unlock(&fbc->lock);
        return ret;
 }
@@ -102,6 +105,7 @@ void percpu_counter_destroy(struct percpu_counter *fbc)
                return;
 
        free_percpu(fbc->counters);
+       fbc->counters = NULL;
 #ifdef CONFIG_HOTPLUG_CPU
        mutex_lock(&percpu_counters_lock);
        list_del(&fbc->list);