From: Fan Du Date: Wed, 3 Jul 2013 22:05:19 +0000 (-0700) Subject: lib/percpu_counter.c: __this_cpu_write() doesn't need to be protected by spinlock X-Git-Tag: v3.11-rc1~99^2~238 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=64df3071a97f20767f63b88c573791691a855b5c;p=platform%2Fkernel%2Flinux-stable.git lib/percpu_counter.c: __this_cpu_write() doesn't need to be protected by spinlock __this_cpu_write doesn't need to be protected by spinlock, AS we are doing per cpu write with preempt disabled. And another reason to remove __this_cpu_write outside of spinlock: __percpu_counter_sum is not an accurate counter. Signed-off-by: Fan Du Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index ba6085d..1fc23a3 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c @@ -80,8 +80,8 @@ void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch) if (count >= batch || count <= -batch) { raw_spin_lock(&fbc->lock); fbc->count += count; - __this_cpu_write(*fbc->counters, 0); raw_spin_unlock(&fbc->lock); + __this_cpu_write(*fbc->counters, 0); } else { __this_cpu_write(*fbc->counters, count); }