From 5db34f5e8f5271e7bd3aefff4387b054980ebc2b Mon Sep 17 00:00:00 2001 From: Gerald Schaefer Date: Wed, 5 Jan 2011 12:48:14 +0100 Subject: [PATCH] --- yaml --- r: 227286 b: refs/heads/master c: 34b133f8e94e39ff3cf4d1c1f67f2e07cdc3d54e h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/Kconfig | 3 +++ trunk/arch/s390/Kconfig | 1 + trunk/arch/s390/include/asm/mutex.h | 2 ++ trunk/include/linux/mutex.h | 4 ++++ trunk/kernel/mutex.c | 2 +- trunk/kernel/sched.c | 3 ++- 7 files changed, 14 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index fbbd2d225b18..5685d2402ce9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c03017544e3b2e60aa3c8ae451fac01595f1bf11 +refs/heads/master: 34b133f8e94e39ff3cf4d1c1f67f2e07cdc3d54e diff --git a/trunk/arch/Kconfig b/trunk/arch/Kconfig index 8bf0fa652eb6..f78c2be4242b 100644 --- a/trunk/arch/Kconfig +++ b/trunk/arch/Kconfig @@ -175,4 +175,7 @@ config HAVE_PERF_EVENTS_NMI config HAVE_ARCH_JUMP_LABEL bool +config HAVE_ARCH_MUTEX_CPU_RELAX + bool + source "kernel/gcov/Kconfig" diff --git a/trunk/arch/s390/Kconfig b/trunk/arch/s390/Kconfig index 3243f7a52c72..c05d0819f562 100644 --- a/trunk/arch/s390/Kconfig +++ b/trunk/arch/s390/Kconfig @@ -87,6 +87,7 @@ config S390 select HAVE_KERNEL_LZMA select HAVE_KERNEL_LZO select HAVE_GET_USER_PAGES_FAST + select HAVE_ARCH_MUTEX_CPU_RELAX select ARCH_INLINE_SPIN_TRYLOCK select ARCH_INLINE_SPIN_TRYLOCK_BH select ARCH_INLINE_SPIN_LOCK diff --git a/trunk/arch/s390/include/asm/mutex.h b/trunk/arch/s390/include/asm/mutex.h index 458c1f7fbc18..688271f5f2e4 100644 --- a/trunk/arch/s390/include/asm/mutex.h +++ b/trunk/arch/s390/include/asm/mutex.h @@ -7,3 +7,5 @@ */ #include + +#define arch_mutex_cpu_relax() barrier() diff --git a/trunk/include/linux/mutex.h b/trunk/include/linux/mutex.h index f363bc8fdc74..94b48bd40dd7 100644 --- a/trunk/include/linux/mutex.h +++ b/trunk/include/linux/mutex.h @@ -160,4 +160,8 @@ extern int mutex_trylock(struct mutex *lock); extern void mutex_unlock(struct mutex *lock); extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); +#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX +#define arch_mutex_cpu_relax() cpu_relax() +#endif + #endif diff --git a/trunk/kernel/mutex.c b/trunk/kernel/mutex.c index 200407c1502f..a5889fb28ecf 100644 --- a/trunk/kernel/mutex.c +++ b/trunk/kernel/mutex.c @@ -199,7 +199,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, * memory barriers as we'll eventually observe the right * values at the cost of a few extra spins. */ - cpu_relax(); + arch_mutex_cpu_relax(); } #endif spin_lock_mutex(&lock->wait_lock, flags); diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index 297d1a0eedb0..fe1c6243d258 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -75,6 +75,7 @@ #include #include +#include #include "sched_cpupri.h" #include "workqueue_sched.h" @@ -4214,7 +4215,7 @@ int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner) if (task_thread_info(rq->curr) != owner || need_resched()) return 0; - cpu_relax(); + arch_mutex_cpu_relax(); } return 1;