aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/spinlock.h
diff options
context:
space:
mode:
authorHisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp>2008-01-26 08:11:28 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-01-26 08:11:31 -0500
commit894cdde26b538c77b9943bc72f0570abf6e58e37 (patch)
tree335f75460bd947c4969c9b7a1ec5764b98bf1d2b /include/asm-s390/spinlock.h
parentdab5209cd878c146d9f6923f061d1c2725ff210f (diff)
[S390] do local_irq_restore while spinning in spin_lock_irqsave.
In s390's spin_lock_irqsave, interrupts remain disabled while spinning. In other architectures like x86 and powerpc, interrupts are re-enabled while spinning if IRQ is not masked before spin_lock_irqsave is called. The following patch re-enables interrupts through local_irq_restore while spinning for a lock acquisition. This can improve system response. [heiko.carstens@de.ibm.com: removed saving of pc] Signed-off-by: Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'include/asm-s390/spinlock.h')
-rw-r--r--include/asm-s390/spinlock.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h
index c1d6e7e304e2..df84ae96915f 100644
--- a/include/asm-s390/spinlock.h
+++ b/include/asm-s390/spinlock.h
@@ -53,12 +53,12 @@ _raw_compare_and_swap(volatile unsigned int *lock,
53 */ 53 */
54 54
55#define __raw_spin_is_locked(x) ((x)->owner_cpu != 0) 55#define __raw_spin_is_locked(x) ((x)->owner_cpu != 0)
56#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
57#define __raw_spin_unlock_wait(lock) \ 56#define __raw_spin_unlock_wait(lock) \
58 do { while (__raw_spin_is_locked(lock)) \ 57 do { while (__raw_spin_is_locked(lock)) \
59 _raw_spin_relax(lock); } while (0) 58 _raw_spin_relax(lock); } while (0)
60 59
61extern void _raw_spin_lock_wait(raw_spinlock_t *); 60extern void _raw_spin_lock_wait(raw_spinlock_t *);
61extern void _raw_spin_lock_wait_flags(raw_spinlock_t *, unsigned long flags);
62extern int _raw_spin_trylock_retry(raw_spinlock_t *); 62extern int _raw_spin_trylock_retry(raw_spinlock_t *);
63extern void _raw_spin_relax(raw_spinlock_t *lock); 63extern void _raw_spin_relax(raw_spinlock_t *lock);
64 64
@@ -72,6 +72,17 @@ static inline void __raw_spin_lock(raw_spinlock_t *lp)
72 _raw_spin_lock_wait(lp); 72 _raw_spin_lock_wait(lp);
73} 73}
74 74
75static inline void __raw_spin_lock_flags(raw_spinlock_t *lp,
76 unsigned long flags)
77{
78 int old;
79
80 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
81 if (likely(old == 0))
82 return;
83 _raw_spin_lock_wait_flags(lp, flags);
84}
85
75static inline int __raw_spin_trylock(raw_spinlock_t *lp) 86static inline int __raw_spin_trylock(raw_spinlock_t *lp)
76{ 87{
77 int old; 88 int old;