locking/refcounts: Implement refcount_dec_and_lock_irqsave()
authorAnna-Maria Gleixner <[email protected]>
Tue, 12 Jun 2018 16:16:21 +0000 (18:16 +0200)
committerThomas Gleixner <[email protected]>
Tue, 12 Jun 2018 21:33:25 +0000 (23:33 +0200)
commit7ea959c45769612aa92557fb6464679f5fec7d9e
tree59727b6ac6c32a2addb41cab2c875ab7caee1b75
parentccfbb5bed407053b27492a9adc06064d949a9aa6
locking/refcounts: Implement refcount_dec_and_lock_irqsave()

There are in-tree users of refcount_dec_and_lock() which must acquire the
spin lock with interrupts disabled. To workaround the lack of an irqsave
variant of refcount_dec_and_lock() they use local_irq_save() at the call
site. This causes extra code and creates in some places unneeded long
interrupt disabled times. These places need also extra treatment for
PREEMPT_RT due to the disconnect of the irq disabling and the lock
function.

Implement the missing irqsave variant of the function.

Signed-off-by: Anna-Maria Gleixner <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lkml.kernel.org/[email protected]
[bigeasy: s@atomic_dec_and_lock@refcount_dec_and_lock@g]
include/linux/refcount.h
lib/refcount.c