Commit d1969a84 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds
Browse files

percpu_counter: unbreak __percpu_counter_add()

Commit 74e72f89

 ("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: default avatarHugh Dickins <>
Cc: Ming Lei <>
Cc: Paul Gortmaker <>
Cc: Shaohua Li <>
Cc: Jens Axboe <>
Cc: Fan Du <>
Cc: Andrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 85ce70fd
......@@ -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);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment