From: James Morris This patch from Kaigai Kohei adds irq and irqsave trylock spinlock variants for use by the SELinux AVC RCU patch. Signed-off-by: Kaigai Kohei Signed-off-by: Stephen Smalley Signed-off-by: James Morris Signed-off-by: Andrew Morton --- 25-akpm/include/linux/spinlock.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+) diff -puN include/linux/spinlock.h~selinux-scalability-add-spin_trylock_irq-and include/linux/spinlock.h --- 25/include/linux/spinlock.h~selinux-scalability-add-spin_trylock_irq-and Mon Nov 15 15:27:33 2004 +++ 25-akpm/include/linux/spinlock.h Mon Nov 15 15:27:33 2004 @@ -468,6 +468,20 @@ do { \ #define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) +#define spin_trylock_irq(lock) \ +({ \ + local_irq_disable(); \ + _spin_trylock(lock) ? \ + 1 : ({local_irq_enable(); 0; }); \ +}) + +#define spin_trylock_irqsave(lock, flags) \ +({ \ + local_irq_save(flags); \ + _spin_trylock(lock) ? \ + 1 : ({local_irq_restore(flags); 0;}); \ +}) + #ifdef CONFIG_LOCKMETER extern void _metered_spin_lock (spinlock_t *lock); extern void _metered_spin_unlock (spinlock_t *lock); _