linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mutex: have non-spinning mutexes on s390 by default
@ 2009-04-09 15:47 Heiko Carstens
  2009-04-09 15:54 ` Peter Zijlstra
  2009-04-17 21:42 ` [PATCH] " Folkert van Heusden
  0 siblings, 2 replies; 12+ messages in thread
From: Heiko Carstens @ 2009-04-09 15:47 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Martin Schwidefsky, Christian Borntraeger, linux-kernel

From: Heiko Carstens <heiko.carstens@de.ibm.com>

The adaptive spinning mutexes will not always do what one would expect on
virtualized architectures like s390. Especially the cpu_relax() loop in
mutex_spin_on_owner might hurt if the mutex holding cpu has been scheduled
away by the hypervisor.
We would end up in a cpu_relax() loop when there is no chance that the
state of the mutex changes until the target cpu has been scheduled again by
the hypervisor.
For that reason we should change the default behaviour to no-spin on s390.

We do have an instruction which allows to yield the current cpu in favour of
a different target cpu. Also we have an instruction which allows us to figure
out if the target cpu is physically backed.

However we need to do some performance tests until we can come up with
a solution that will do the right thing on s390.
Until then make the old behaviour default for us.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 arch/Kconfig            |    3 +++
 arch/s390/Kconfig       |    1 +
 kernel/sched_features.h |    4 ++++
 3 files changed, 8 insertions(+)

Index: linux-2.6/arch/Kconfig
===================================================================
--- linux-2.6.orig/arch/Kconfig
+++ linux-2.6/arch/Kconfig
@@ -109,3 +109,6 @@ config HAVE_CLK
 
 config HAVE_DMA_API_DEBUG
 	bool
+
+config HAVE_DEFAULT_NO_SPIN_MUTEXES
+	bool
Index: linux-2.6/arch/s390/Kconfig
===================================================================
--- linux-2.6.orig/arch/s390/Kconfig
+++ linux-2.6/arch/s390/Kconfig
@@ -82,6 +82,7 @@ config S390
 	select USE_GENERIC_SMP_HELPERS if SMP
 	select HAVE_SYSCALL_WRAPPERS
 	select HAVE_FUNCTION_TRACER
+	select HAVE_DEFAULT_NO_SPIN_MUTEXES
 	select HAVE_OPROFILE
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
Index: linux-2.6/kernel/sched_features.h
===================================================================
--- linux-2.6.orig/kernel/sched_features.h
+++ linux-2.6/kernel/sched_features.h
@@ -14,4 +14,8 @@ SCHED_FEAT(LB_WAKEUP_UPDATE, 1)
 SCHED_FEAT(ASYM_EFF_LOAD, 1)
 SCHED_FEAT(WAKEUP_OVERLAP, 0)
 SCHED_FEAT(LAST_BUDDY, 1)
+#ifdef CONFIG_HAVE_DEFAULT_NO_SPIN_MUTEXES
+SCHED_FEAT(OWNER_SPIN, 0)
+#else
 SCHED_FEAT(OWNER_SPIN, 1)
+#endif

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-04-20 12:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-09 15:47 [PATCH] mutex: have non-spinning mutexes on s390 by default Heiko Carstens
2009-04-09 15:54 ` Peter Zijlstra
2009-04-09 16:14   ` Heiko Carstens
2009-04-09 16:48     ` Heiko Carstens
2009-04-09 16:53       ` Peter Zijlstra
2009-04-09 17:38         ` Peter Zijlstra
2009-04-09 17:50           ` Jeremy Fitzhardinge
2009-04-09 18:34             ` Peter Zijlstra
2009-04-09 18:12       ` [tip:core/urgent] " Heiko Carstens
2009-04-17 21:42 ` [PATCH] " Folkert van Heusden
2009-04-20 12:01   ` Heiko Carstens
2009-04-20 12:04     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).