summaryrefslogtreecommitdiffstats
path: root/include/asm-s390/processor.h
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2005-07-27 11:44:57 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-27 16:26:04 -0700
commit951f22d5b1f0eaae35dafc669e3774a0c2084d10 (patch)
tree66c0131b576dadb98026da11d624df453c4c9a7c /include/asm-s390/processor.h
parent8449d003f323ca7a00eec38905d984ba5ec83a29 (diff)
downloadlinux-951f22d5b1f0eaae35dafc669e3774a0c2084d10.tar.gz
linux-951f22d5b1f0eaae35dafc669e3774a0c2084d10.tar.bz2
linux-951f22d5b1f0eaae35dafc669e3774a0c2084d10.zip
[PATCH] s390: spin lock retry
Split spin lock and r/w lock implementation into a single try which is done inline and an out of line function that repeatedly tries to get the lock before doing the cpu_relax(). Add a system control to set the number of retries before a cpu is yielded. The reason for the spin lock retry is that the diagnose 0x44 that is used to give up the virtual cpu is quite expensive. For spin locks that are held only for a short period of time the costs of the diagnoses outweights the savings for spin locks that are held for a longer timer. The default retry count is 1000. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-s390/processor.h')
-rw-r--r--include/asm-s390/processor.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index 8bd14de69e35..4ec652ebb3b1 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -203,7 +203,10 @@ unsigned long get_wchan(struct task_struct *p);
# define cpu_relax() asm volatile ("diag 0,0,68" : : : "memory")
#else /* __s390x__ */
# define cpu_relax() \
- asm volatile ("ex 0,%0" : : "i" (__LC_DIAG44_OPCODE) : "memory")
+ do { \
+ if (MACHINE_HAS_DIAG44) \
+ asm volatile ("diag 0,0,68" : : : "memory"); \
+ } while (0)
#endif /* __s390x__ */
/*