X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2Fpercpu_counter.c;h=8280a5dd172780371711743d297fcd0fd4e4360a;hb=f29d778fa47aacb4b0e7dede603756ac782c9391;hp=7473ee3b4ee712b0759e264b79f350457888be1e;hpb=6eb37eb276f0b91adb43b853ce6fb0812fbf0883;p=firefly-linux-kernel-4.4.55.git diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index 7473ee3b4ee7..8280a5dd1727 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c @@ -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 - amount); 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(); }