<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/mutex.c, branch v2.6.30</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.30</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.30'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2009-04-09T17:28:24Z</updated>
<entry>
<title>mutex: have non-spinning mutexes on s390 by default</title>
<updated>2009-04-09T17:28:24Z</updated>
<author>
<name>Heiko Carstens</name>
<email>heiko.carstens@de.ibm.com</email>
</author>
<published>2009-04-09T16:48:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=36cd3c9f925b9307236505ae7ad1ad7ac4d4357c'/>
<id>urn:sha1:36cd3c9f925b9307236505ae7ad1ad7ac4d4357c</id>
<content type='text'>
Impact: performance regression fix for s390

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.

Signed-off-by: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Cc: Christian Borntraeger &lt;borntraeger@de.ibm.com&gt;
LKML-Reference: &lt;20090409184834.7a0df7b2@osiris.boeblingen.de.ibm.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>mutex: adaptive spinnning, performance tweaks</title>
<updated>2009-01-14T18:03:54Z</updated>
<author>
<name>Chris Mason</name>
<email>chris.mason@oracle.com</email>
</author>
<published>2009-01-14T16:29:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ac6e60ee405aa3bf718f7fe4cb01b7ee0b8877ec'/>
<id>urn:sha1:ac6e60ee405aa3bf718f7fe4cb01b7ee0b8877ec</id>
<content type='text'>
Spin more agressively. This is less fair but also markedly faster.

The numbers:

 * dbench 50 (higher is better):
  spin        1282MB/s
  v10         548MB/s
  v10 no wait 1868MB/s

 * 4k creates (numbers in files/second higher is better):
  spin        avg 200.60 median 193.20 std 19.71 high 305.93 low 186.82
  v10         avg 180.94 median 175.28 std 13.91 high 229.31 low 168.73
  v10 no wait avg 232.18 median 222.38 std 22.91 high 314.66 low 209.12

 * File stats (numbers in seconds, lower is better):
  spin        2.27s
  v10         5.1s
  v10 no wait 1.6s

( The source changes are smaller than they look, I just moved the
  need_resched checks in __mutex_lock_common after the cmpxchg. )

Signed-off-by: Chris Mason &lt;chris.mason@oracle.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>mutex: implement adaptive spinning</title>
<updated>2009-01-14T17:09:02Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2009-01-12T13:01:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0d66bf6d3514b35eb6897629059443132992dbd7'/>
<id>urn:sha1:0d66bf6d3514b35eb6897629059443132992dbd7</id>
<content type='text'>
Change mutex contention behaviour such that it will sometimes busy wait on
acquisition - moving its behaviour closer to that of spinlocks.

This concept got ported to mainline from the -rt tree, where it was originally
implemented for rtmutexes by Steven Rostedt, based on work by Gregory Haskins.

Testing with Ingo's test-mutex application (http://lkml.org/lkml/2006/1/8/50)
gave a 345% boost for VFS scalability on my testbox:

 # ./test-mutex-shm V 16 10 | grep "^avg ops"
 avg ops/sec:               296604

 # ./test-mutex-shm V 16 10 | grep "^avg ops"
 avg ops/sec:               85870

The key criteria for the busy wait is that the lock owner has to be running on
a (different) cpu. The idea is that as long as the owner is running, there is a
fair chance it'll release the lock soon, and thus we'll be better off spinning
instead of blocking/scheduling.

Since regular mutexes (as opposed to rtmutexes) do not atomically track the
owner, we add the owner in a non-atomic fashion and deal with the races in
the slowpath.

Furthermore, to ease the testing of the performance impact of this new code,
there is means to disable this behaviour runtime (without having to reboot
the system), when scheduler debugging is enabled (CONFIG_SCHED_DEBUG=y),
by issuing the following command:

 # echo NO_OWNER_SPIN &gt; /debug/sched_features

This command re-enables spinning again (this is also the default):

 # echo OWNER_SPIN &gt; /debug/sched_features

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>mutex: preemption fixes</title>
<updated>2009-01-14T17:09:00Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2009-01-14T14:36:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=41719b03091911028116155deddc5eedf8c45e37'/>
<id>urn:sha1:41719b03091911028116155deddc5eedf8c45e37</id>
<content type='text'>
The problem is that dropping the spinlock right before schedule is a voluntary
preemption point and can cause a schedule, right after which we schedule again.

Fix this inefficiency by keeping preemption disabled until we schedule, do this
by explicity disabling preemption and providing a schedule() variant that
assumes preemption is already disabled.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>mutex: small cleanup</title>
<updated>2009-01-14T17:08:58Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2009-01-14T14:32:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=93d81d1aca26e64a75d06a85f7e128b5f49053e7'/>
<id>urn:sha1:93d81d1aca26e64a75d06a85f7e128b5f49053e7</id>
<content type='text'>
Remove a local variable by combining an assingment and test in one.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>mutex: __used is needed for function referenced only from inline asm</title>
<updated>2008-11-24T09:00:28Z</updated>
<author>
<name>Török Edwin</name>
<email>edwintorok@gmail.com</email>
</author>
<published>2008-11-24T08:17:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7918baa555140989eeee1270f48533987d48fdba'/>
<id>urn:sha1:7918baa555140989eeee1270f48533987d48fdba</id>
<content type='text'>
Impact: fix build failure on llvm-gcc-4.2

According to the gcc manual, the 'used' attribute should be applied to
functions referenced only from inline assembly.
This fixes a build failure with llvm-gcc-4.2, which deleted
__mutex_lock_slowpath, __mutex_unlock_slowpath.

Signed-off-by: Török Edwin &lt;edwintorok@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>lockstat: contend with points</title>
<updated>2008-10-20T13:43:10Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2008-10-16T21:17:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c7e78cff6b7518212247fb20b1dc6411540dc9af'/>
<id>urn:sha1:c7e78cff6b7518212247fb20b1dc6411540dc9af</id>
<content type='text'>
We currently only provide points that have to wait on contention, also
lists the points we have to wait for.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>locking: fix mutex @key parameter kernel-doc notation</title>
<updated>2008-07-28T16:12:36Z</updated>
<author>
<name>Randy Dunlap</name>
<email>randy.dunlap@oracle.com</email>
</author>
<published>2008-07-24T23:58:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0e241ffd306c0896bb9959be7faa4d4cfcb706d9'/>
<id>urn:sha1:0e241ffd306c0896bb9959be7faa4d4cfcb706d9</id>
<content type='text'>
Fix @key parameter to mutex_init() and one of its callers.

Warning(linux-2.6.26-git11//drivers/base/class.c:210): No description found for parameter 'key'

Signed-off-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>__mutex_lock_common: use signal_pending_state()</title>
<updated>2008-06-10T09:45:09Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@tv-sign.ru</email>
</author>
<published>2008-06-08T17:20:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6ad36762d7a88d747f6fed95194b4f7ff5da8df4'/>
<id>urn:sha1:6ad36762d7a88d747f6fed95194b4f7ff5da8df4</id>
<content type='text'>
Change __mutex_lock_common() to use signal_pending_state() for the sake of
the code re-use.

This adds 7 bytes to kernel/mutex.o, but afaics only because gcc isn't smart
enough.

(btw, uninlining of __mutex_lock_common() shrinks .text from 2722 to 1542,
 perhaps it is worth doing).

Signed-off-by: Oleg Nesterov &lt;oleg@tv-sign.ru&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>kernel: remove fastcall in kernel/*</title>
<updated>2008-02-08T17:22:31Z</updated>
<author>
<name>Harvey Harrison</name>
<email>harvey.harrison@gmail.com</email>
</author>
<published>2008-02-08T12:19:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7ad5b3a505e68cfdc342933d6e0fc0eaa5e0a4f7'/>
<id>urn:sha1:7ad5b3a505e68cfdc342933d6e0fc0eaa5e0a4f7</id>
<content type='text'>
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Acked-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
