summaryrefslogtreecommitdiff
path: root/lib/percpu_counter.c
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2014-01-16 15:26:48 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-17 11:32:24 +1100
commitd1969a84dd6a44d375aa82bba7d6c38713a429c3 (patch)
tree26d4c1e2915dc960f28abec72d024ddbf4c57924 /lib/percpu_counter.c
parent85ce70fdf48aa290b4845311c2dd815d7f8d1fa5 (diff)
downloadlwn-d1969a84dd6a44d375aa82bba7d6c38713a429c3.tar.gz
lwn-d1969a84dd6a44d375aa82bba7d6c38713a429c3.zip
percpu_counter: unbreak __percpu_counter_add()
Commit 74e72f894d56 ("lib/percpu_counter.c: fix __percpu_counter_add()") looked very plausible, but its arithmetic was badly wrong: obvious once you see the fix, but maddening to get there from the weird tmpfs ENOSPCs Signed-off-by: Hugh Dickins <hughd@google.com> Cc: Ming Lei <tom.leiming@gmail.com> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Shaohua Li <shli@fusionio.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Fan Du <fan.du@windriver.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/percpu_counter.c')
-rw-r--r--lib/percpu_counter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index 1da85bb1bc07..8280a5dd1727 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -82,7 +82,7 @@ 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);
+ __this_cpu_sub(*fbc->counters, count - amount);
raw_spin_unlock_irqrestore(&fbc->lock, flags);
} else {
this_cpu_add(*fbc->counters, amount);