diff options
author | Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp> | 2008-01-26 08:11:28 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-01-26 08:11:31 -0500 |
commit | 894cdde26b538c77b9943bc72f0570abf6e58e37 (patch) | |
tree | 335f75460bd947c4969c9b7a1ec5764b98bf1d2b /arch/s390 | |
parent | dab5209cd878c146d9f6923f061d1c2725ff210f (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 'arch/s390')
-rw-r--r-- | arch/s390/lib/spinlock.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c index 59c56c3d72d0..e41f4008afc5 100644 --- a/arch/s390/lib/spinlock.c +++ b/arch/s390/lib/spinlock.c | |||
@@ -59,6 +59,29 @@ void _raw_spin_lock_wait(raw_spinlock_t *lp) | |||
59 | } | 59 | } |
60 | EXPORT_SYMBOL(_raw_spin_lock_wait); | 60 | EXPORT_SYMBOL(_raw_spin_lock_wait); |
61 | 61 | ||
62 | void _raw_spin_lock_wait_flags(raw_spinlock_t *lp, unsigned long flags) | ||
63 | { | ||
64 | int count = spin_retry; | ||
65 | unsigned int cpu = ~smp_processor_id(); | ||
66 | |||
67 | local_irq_restore(flags); | ||
68 | while (1) { | ||
69 | if (count-- <= 0) { | ||
70 | unsigned int owner = lp->owner_cpu; | ||
71 | if (owner != 0) | ||
72 | _raw_yield_cpu(~owner); | ||
73 | count = spin_retry; | ||
74 | } | ||
75 | if (__raw_spin_is_locked(lp)) | ||
76 | continue; | ||
77 | local_irq_disable(); | ||
78 | if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) | ||
79 | return; | ||
80 | local_irq_restore(flags); | ||
81 | } | ||
82 | } | ||
83 | EXPORT_SYMBOL(_raw_spin_lock_wait_flags); | ||
84 | |||
62 | int _raw_spin_trylock_retry(raw_spinlock_t *lp) | 85 | int _raw_spin_trylock_retry(raw_spinlock_t *lp) |
63 | { | 86 | { |
64 | unsigned int cpu = ~smp_processor_id(); | 87 | unsigned int cpu = ~smp_processor_id(); |