login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
October
»
15
Re: [PATCH] mutex: Introduce mutex_cpu_relax()
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Gerald Schaefer
Subject:
Re: [PATCH] mutex: Introduce mutex_cpu_relax()
Date: Friday, October 15, 2010 - 3:55 am
On Thu, 2010-10-14 at 15:13 -0700, Andrew Morton wrote:
quoted text
> On Thu, 14 Oct 2010 19:40:25 +0200 > Gerald Schaefer <gerald.schaefer@de.ibm.com> wrote: > > > From: Gerald Schaefer <gerald.schaefer@de.ibm.com> > > > > The spinning mutex implementation uses cpu_relax() in busy loops as a > > compiler barrier. Depending on the architecture, cpu_relax() may do more > > than needed in this specific mutex spin loops. On System z we also give > > up the time slice of the virtual cpu in cpu_relax(), which prevents > > effective spinning on the mutex. > > > > This patch replaces cpu_relax() in the spinning mutex code with a new > > function mutex_cpu_relax(), which can be defined by each architecture > > that selects HAVE_MUTEX_CPU_RELAX. The default is still cpu_relax(), so > > this patch should not affect other architectures than System z for now. > > > > Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> > > --- > > arch/Kconfig | 3 +++ > > arch/s390/Kconfig | 1 + > > arch/s390/include/asm/mutex.h | 2 ++ > > include/linux/mutex.h | 4 ++++ > > kernel/mutex.c | 2 +- > > kernel/sched.c | 2 +- > > 6 files changed, 12 insertions(+), 2 deletions(-) > > > > --- a/arch/Kconfig > > +++ b/arch/Kconfig > > @@ -158,4 +158,7 @@ config HAVE_PERF_EVENTS_NMI > > subsystem. Also has support for calculating CPU cycle events > > to determine how many clock cycles in a given period. > > > > +config HAVE_MUTEX_CPU_RELAX > > + bool > > + > > source "kernel/gcov/Kconfig" > > --- a/arch/s390/Kconfig > > +++ b/arch/s390/Kconfig > > @@ -100,6 +100,7 @@ config S390 > > select HAVE_KERNEL_BZIP2 > > select HAVE_KERNEL_LZMA > > select HAVE_KERNEL_LZO > > + select HAVE_MUTEX_CPU_RELAX > > select ARCH_INLINE_SPIN_TRYLOCK > > select ARCH_INLINE_SPIN_TRYLOCK_BH > > select ARCH_INLINE_SPIN_LOCK > > We could just omit the HAVE_MUTEX_CPU_RELAX > > > --- a/arch/s390/include/asm/mutex.h > > +++ b/arch/s390/include/asm/mutex.h > > @@ -7,3 +7,5 @@ > > */ > > > > #include <asm-generic/mutex-dec.h> > > + > > +#define mutex_cpu_relax() barrier() > > --- a/include/linux/mutex.h > > +++ b/include/linux/mutex.h > > @@ -160,4 +160,8 @@ extern int mutex_trylock(struct mutex *l > > extern void mutex_unlock(struct mutex *lock); > > extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); > > > > +#ifndef CONFIG_HAVE_MUTEX_CPU_RELAX > > +#define mutex_cpu_relax() cpu_relax() > > +#endif > > and do `#ifndef mutex_cpu_relax' here. That's a pretty common trick. > It's best to add a comment telling people which arch header file should > define mutex_cpu_relax, so everyone does it the same way. > > It should perhaps be called arch_mutex_cpu_relax().
Nice trick, I'll send a new patch. --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] mutex: Introduce mutex_cpu_relax()
, Gerald Schaefer
, (Thu Oct 14, 8:33 am)
Re: [PATCH] mutex: Introduce mutex_cpu_relax()
, Peter Zijlstra
, (Thu Oct 14, 8:55 am)
Re: [PATCH] mutex: Introduce mutex_cpu_relax()
, Peter Zijlstra
, (Thu Oct 14, 8:59 am)
Re: [PATCH] mutex: Introduce mutex_cpu_relax()
, Gerald Schaefer
, (Thu Oct 14, 10:31 am)
[PATCH] mutex: Introduce mutex_cpu_relax()
, Gerald Schaefer
, (Thu Oct 14, 10:40 am)
Re: [PATCH] mutex: Introduce mutex_cpu_relax()
, Andrew Morton
, (Thu Oct 14, 3:13 pm)
Re: [PATCH] mutex: Introduce mutex_cpu_relax()
, Gerald Schaefer
, (Fri Oct 15, 3:55 am)
[PATCH] mutex: Introduce arch_mutex_cpu_relax()
, Gerald Schaefer
, (Fri Oct 15, 4:07 am)
Re: [PATCH] mutex: Introduce arch_mutex_cpu_relax()
, Peter Zijlstra
, (Mon Oct 18, 11:54 am)
Re: [PATCH] mutex: Introduce arch_mutex_cpu_relax()
, Gerald Schaefer
, (Tue Oct 19, 5:24 am)
[PATCH] mutex: Introduce arch_mutex_cpu_relax()
, Gerald Schaefer
, (Tue Oct 19, 8:18 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Rusty Russell
Re: 2.6.22-rc3-mm1
Bill Fink
Re: [PATCH] net: add ability to clear stats via ethtool - e1000/pcnet32
Jeffrey V. Merkey
Re: Versioning file system
Alexey Dobriyan
Re: [2.6.22.2 review 09/84] Fix rfkill IRQ flags.
Luben Tuikov
Re: Integration of SCST in the mainstream Linux kernel
git-commits-head
:
Linux Kernel Mailing List
V4L/DVB: tm6000: add special usb request to quit i2c tuner transfer
Linux Kernel Mailing List
OMAP: DSS2: SDI driver
Linux Kernel Mailing List
PCI: introduce pci_pcie_cap()
Linux Kernel Mailing List
drivers/acpi: use kasprintf
Linux Kernel Mailing List
PCI hotplug: acpiphp: remove superfluous _HPP/_HPX evaluation
linux-netdev
:
David Miller
Re: [2.6.30-rc3] powerpc: compilation error of mace module
Rafael J. Wysocki
Re: [PATCH] igb: fix kexec with igb
Patrick McHardy
Re: [rfc 02/13] [RFC 02/13] netfilter: nf_conntrack_sip: Add callid parser
webmaster Maintenance
&#32852;&#31995;&#31995;&#32479;&#31649;&#29702;&#21592;
Krzysztof Oledzki
Re: Error: an inet prefix is expected rather than "0/0".
openbsd-misc
:
Ted Bullock
Re: Proliant DL380 G3 cannot get on network
Jack J. Woehr
Re: Real men don't attack straw men
Úlfar M. E. Johnson
installing openbsd in xen
Eric Furman
Re: Defending OpenBSD Performance
Tony Abernethy
Re: The Atheros story in much fewer words
git
:
Oliver Kullmann
Re: how to move with history?
Junio C Hamano
Re: [PATCH 2/3] git-add--interactive: remove hunk coalescing
Shawn O. Pearce
Re: Bugs in Gitosis
Alex Riesen
Re: git exclude patterns for directory
David Kastrup
Re: I'm a total push-over..
Colocation donated by:
Syndicate