percpu_counter: Use helper macro abs()
Subsystems (2)
PATCH 1/1 percpu_counter: Use helper macro abs()
Use helper macro abs() to simplify the "x >= t || x <= -t" cmp.
Signed-off-by Miaohe Lin <[email protected]>
--- lib/percpu_counter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/percpu_counter.c +1 -1
@@ -85,7 +85,7 @@ void percpu_counter_add_batch(struct percpu_counter *fbc, s64 amount, s32 batch)preempt_disable (); count =__this_cpu_read (*fbc->counters) + amount; -if (count >= batch || count <= -batch) { +if (abs (count) >= batch) {unsigned long flags;raw_spin_lock_irqsave (&fbc->lock, flags); fbc->count += count;
Signature · 1 line
2.19.1