Merge branches 'sched-urgent-for-linus' and 'timers-urgent-for-linus' of git://git...
[deliverable/linux.git] / lib / percpu_counter.c
index 7473ee3b4ee712b0759e264b79f350457888be1e..1da85bb1bc07ad3289b698776ed174b0f901e17c 100644 (file)
@@ -82,10 +82,10 @@ void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
                unsigned long flags;
                raw_spin_lock_irqsave(&fbc->lock, flags);
                fbc->count += count;
+                __this_cpu_sub(*fbc->counters, count);
                raw_spin_unlock_irqrestore(&fbc->lock, flags);
-               __this_cpu_write(*fbc->counters, 0);
        } else {
-               __this_cpu_write(*fbc->counters, count);
+               this_cpu_add(*fbc->counters, amount);
        }
        preempt_enable();
 }
This page took 0.035318 seconds and 5 git commands to generate.