diff options
| author | James Morris <jmorris@redhat.com> | 2005-01-04 05:39:08 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-04 05:39:08 -0800 |
| commit | b0f31274364e831369d72d755e4f4f36a3eb78d5 (patch) | |
| tree | e5ef503ad26cf65fd826c7c74fd27630e7ac1237 /include/linux | |
| parent | 5e238cebe52131f0b5880411694d3585fc5465ef (diff) | |
[PATCH] SELinux scalability: add spin_trylock_irq and spin_trylock_irqsave
This patch from Kaigai Kohei <kaigai@ak.jp.nec.com> adds irq and irqsave
trylock spinlock variants for use by the SELinux AVC RCU patch.
Signed-off-by: Kaigai Kohei <kaigai@ak.jp.nec.com>
Signed-off-by: Stephen Smalley <sds@epoch.ncsc.mil>
Signed-off-by: James Morris <jmorris@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/spinlock.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 41220e075bca..027c06f522bd 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -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); |
