diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2010-12-28 12:16:58 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2010-12-28 12:16:58 +1100 |
commit | ff71abad53cdd1856e6a77ef71a09f1df46c9b87 (patch) | |
tree | 82f61a0765f7ea45fb6bd87a537bb656eb181601 /lib/percpu_counter.c | |
parent | aaca8c6eac21c9a662d87ff0e83eb176af970213 (diff) | |
parent | b924047fe07689ed9b7f0a8e14826534caaff8fc (diff) |
Merge remote branch 'percpu/for-next'
Diffstat (limited to 'lib/percpu_counter.c')
-rw-r--r-- | lib/percpu_counter.c | 8 |
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(); } |