Merge branch 'linus' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
@@ -23,7 +23,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
|
||||
sha1.o chacha20.o irq_regs.o argv_split.o \
|
||||
flex_proportions.o ratelimit.o show_mem.o \
|
||||
is_single_threaded.o plist.o decompress.o kobject_uevent.o \
|
||||
earlycpio.o seq_buf.o siphash.o \
|
||||
earlycpio.o seq_buf.o siphash.o dec_and_lock.o \
|
||||
nmi_backtrace.o nodemask.o win_minmax.o
|
||||
|
||||
lib-$(CONFIG_PRINTK) += dump_stack.o
|
||||
@@ -95,10 +95,6 @@ obj-$(CONFIG_DEBUG_PREEMPT) += smp_processor_id.o
|
||||
obj-$(CONFIG_DEBUG_LIST) += list_debug.o
|
||||
obj-$(CONFIG_DEBUG_OBJECTS) += debugobjects.o
|
||||
|
||||
ifneq ($(CONFIG_HAVE_DEC_LOCK),y)
|
||||
lib-y += dec_and_lock.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_BITREVERSE) += bitrev.o
|
||||
obj-$(CONFIG_RATIONAL) += rational.o
|
||||
obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o
|
||||
|
@@ -33,3 +33,19 @@ int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(_atomic_dec_and_lock);
|
||||
|
||||
int _atomic_dec_and_lock_irqsave(atomic_t *atomic, spinlock_t *lock,
|
||||
unsigned long *flags)
|
||||
{
|
||||
/* Subtract 1 from counter unless that drops it to 0 (ie. it was 1) */
|
||||
if (atomic_add_unless(atomic, -1, 1))
|
||||
return 0;
|
||||
|
||||
/* Otherwise do it the slow way */
|
||||
spin_lock_irqsave(lock, *flags);
|
||||
if (atomic_dec_and_test(atomic))
|
||||
return 1;
|
||||
spin_unlock_irqrestore(lock, *flags);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(_atomic_dec_and_lock_irqsave);
|
||||
|
@@ -350,3 +350,31 @@ bool refcount_dec_and_lock(refcount_t *r, spinlock_t *lock)
|
||||
}
|
||||
EXPORT_SYMBOL(refcount_dec_and_lock);
|
||||
|
||||
/**
|
||||
* refcount_dec_and_lock_irqsave - return holding spinlock with disabled
|
||||
* interrupts if able to decrement refcount to 0
|
||||
* @r: the refcount
|
||||
* @lock: the spinlock to be locked
|
||||
* @flags: saved IRQ-flags if the is acquired
|
||||
*
|
||||
* Same as refcount_dec_and_lock() above except that the spinlock is acquired
|
||||
* with disabled interupts.
|
||||
*
|
||||
* Return: true and hold spinlock if able to decrement refcount to 0, false
|
||||
* otherwise
|
||||
*/
|
||||
bool refcount_dec_and_lock_irqsave(refcount_t *r, spinlock_t *lock,
|
||||
unsigned long *flags)
|
||||
{
|
||||
if (refcount_dec_not_one(r))
|
||||
return false;
|
||||
|
||||
spin_lock_irqsave(lock, *flags);
|
||||
if (!refcount_dec_and_test(r)) {
|
||||
spin_unlock_irqrestore(lock, *flags);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL(refcount_dec_and_lock_irqsave);
|
||||
|
Reference in New Issue
Block a user