summaryrefslogtreecommitdiff
path: root/lib/percpu_counter.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2010-12-28 12:16:58 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2010-12-28 12:16:58 +1100
commitff71abad53cdd1856e6a77ef71a09f1df46c9b87 (patch)
tree82f61a0765f7ea45fb6bd87a537bb656eb181601 /lib/percpu_counter.c
parentaaca8c6eac21c9a662d87ff0e83eb176af970213 (diff)
parentb924047fe07689ed9b7f0a8e14826534caaff8fc (diff)
Merge remote branch 'percpu/for-next'
Diffstat (limited to 'lib/percpu_counter.c')
-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();
}