summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2010-12-10 13:21:22 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2010-12-10 13:21:22 +1100
commitc319a293b4dc90769f16579d99b11ae4e0382b9c (patch)
tree5fd270e240819d39213028164b1b628ba3cd126a /lib
parent005d26868e9a839db816693432716ee5389c6f90 (diff)
parent5d201a6821425cb331a1dd5ccaba47fc75692e2b (diff)
Merge remote branch 'percpu/for-next'
Conflicts: arch/x86/kernel/apic/nmi.c
Diffstat (limited to 'lib')
-rw-r--r--lib/percpu_counter.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index 604678d7d06d..28f2c33c6b53 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -72,18 +72,16 @@ EXPORT_SYMBOL(percpu_counter_set);
void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
{
s64 count;
- s32 *pcount;
preempt_disable();
- pcount = this_cpu_ptr(fbc->counters);
- count = *pcount + amount;
+ count = __this_cpu_read(*fbc->counters) + amount;
if (count >= batch || count <= -batch) {
spin_lock(&fbc->lock);
fbc->count += count;
- *pcount = 0;
+ __this_cpu_write(*fbc->counters, 0);
spin_unlock(&fbc->lock);
} else {
- *pcount = count;
+ __this_cpu_write(*fbc->counters, count);
}
preempt_enable();
}