diff options
author | Anna-Maria Gleixner <anna-maria@linutronix.de> | 2018-06-12 18:16:21 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-06-12 23:33:25 +0200 |
commit | 7ea959c45769612aa92557fb6464679f5fec7d9e (patch) | |
tree | 59727b6ac6c32a2addb41cab2c875ab7caee1b75 /include | |
parent | ccfbb5bed407053b27492a9adc06064d949a9aa6 (diff) | |
download | linux-stable-7ea959c45769612aa92557fb6464679f5fec7d9e.tar.gz linux-stable-7ea959c45769612aa92557fb6464679f5fec7d9e.tar.bz2 linux-stable-7ea959c45769612aa92557fb6464679f5fec7d9e.zip |
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 <anna-maria@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r20180612161621.22645-4-bigeasy@linutronix.de
[bigeasy: s@atomic_dec_and_lock@refcount_dec_and_lock@g]
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/refcount.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/refcount.h b/include/linux/refcount.h index 4193c41e383a..a685da2c4522 100644 --- a/include/linux/refcount.h +++ b/include/linux/refcount.h @@ -98,5 +98,7 @@ extern __must_check bool refcount_dec_if_one(refcount_t *r); extern __must_check bool refcount_dec_not_one(refcount_t *r); extern __must_check bool refcount_dec_and_mutex_lock(refcount_t *r, struct mutex *lock); extern __must_check bool refcount_dec_and_lock(refcount_t *r, spinlock_t *lock); - +extern __must_check bool refcount_dec_and_lock_irqsave(refcount_t *r, + spinlock_t *lock, + unsigned long *flags); #endif /* _LINUX_REFCOUNT_H */ |