<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/mutex.c, branch v2.6.35</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.35</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.35'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2010-05-19T06:18:44Z</updated>
<entry>
<title>mutex: Fix optimistic spinning vs. BKL</title>
<updated>2010-05-19T06:18:44Z</updated>
<author>
<name>Tony Breeds</name>
<email>tony@bakeyournoodle.com</email>
</author>
<published>2010-05-19T05:46:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fd6be105b883244127a734ac9f14ae94a022dcc0'/>
<id>urn:sha1:fd6be105b883244127a734ac9f14ae94a022dcc0</id>
<content type='text'>
Currently, we can hit a nasty case with optimistic
spinning on mutexes:

    CPU A tries to take a mutex, while holding the BKL

    CPU B tried to take the BLK while holding the mutex

This looks like a AB-BA scenario but in practice, is
allowed and happens due to the auto-release on
schedule() nature of the BKL.

In that case, the optimistic spinning code can get us
into a situation where instead of going to sleep, A
will spin waiting for B who is spinning waiting for
A, and the only way out of that loop is the
need_resched() test in mutex_spin_on_owner().

This patch fixes it by completely disabling spinning
if we own the BKL. This adds one more detail to the
extensive list of reasons why it's a bad idea for
kernel code to be holding the BKL.

Signed-off-by: Tony Breeds &lt;tony@bakeyournoodle.com&gt;
Acked-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: &lt;stable@kernel.org&gt;
LKML-Reference: &lt;20100519054636.GC12389@ozlabs.org&gt;
[ added an unlikely() attribute to the branch ]
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>mutex: Better control mutex adaptive spinning config</title>
<updated>2009-12-03T10:50:11Z</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2009-12-02T19:49:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c02260277e472095ffb3ad893be5eeab9dcefde3'/>
<id>urn:sha1:c02260277e472095ffb3ad893be5eeab9dcefde3</id>
<content type='text'>
Introduce CONFIG_MUTEX_SPIN_ON_OWNER so that we can centralize
in a single place the conditions that determine its definition
and use.

Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Acked-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
LKML-Reference: &lt;1259783357-8542-1-git-send-regression-fweisbec@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'linus' into perfcounters/core</title>
<updated>2009-06-11T15:55:42Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2009-06-11T15:55:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=940010c5a314a7bd9b498593bc6ba1718ac5aec5'/>
<id>urn:sha1:940010c5a314a7bd9b498593bc6ba1718ac5aec5</id>
<content type='text'>
Conflicts:
	arch/x86/kernel/irqinit.c
	arch/x86/kernel/irqinit_64.c
	arch/x86/kernel/traps.c
	arch/x86/mm/fault.c
	include/linux/sched.h
	kernel/exit.c
</content>
</entry>
<entry>
<title>Merge branch 'locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip</title>
<updated>2009-06-10T23:19:40Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2009-06-10T23:19:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e7241d771419b8a8671ebc46a043c324ccb0dcf7'/>
<id>urn:sha1:e7241d771419b8a8671ebc46a043c324ccb0dcf7</id>
<content type='text'>
* 'locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  spinlock: Add missing __raw_spin_lock_flags() stub for UP
  mutex: add atomic_dec_and_mutex_lock(), fix
  locking, rtmutex.c: Documentation cleanup
  mutex: add atomic_dec_and_mutex_lock()
</content>
</entry>
<entry>
<title>Merge commit 'v2.6.30-rc5' into sched/core</title>
<updated>2009-05-11T10:59:37Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2009-05-11T10:59:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7961386fe9596e6bf03d09948a73c5df9653325b'/>
<id>urn:sha1:7961386fe9596e6bf03d09948a73c5df9653325b</id>
<content type='text'>
Merge reason: sched/core was on .30-rc1 before, update to latest fixes

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>Merge branch 'core/locking' into perfcounters/core</title>
<updated>2009-05-06T06:47:26Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2009-05-06T06:46:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3611dfb8eda847c1c8e1a052f57206f7fddc6a7c'/>
<id>urn:sha1:3611dfb8eda847c1c8e1a052f57206f7fddc6a7c</id>
<content type='text'>
Merge reason: we moved a mutex.h commit that originated from the
              perfcounters tree into core/locking - but now merge
	      back that branch to solve a merge artifact and to
	      pick up cleanups of this commit that happened in
	      core/locking.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>mutex: add atomic_dec_and_mutex_lock(), fix</title>
<updated>2009-04-30T07:01:34Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@linux-foundation.org</email>
</author>
<published>2009-04-29T22:59:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a511e3f968c462a55ef58697257f5347c73d306e'/>
<id>urn:sha1:a511e3f968c462a55ef58697257f5347c73d306e</id>
<content type='text'>
include/linux/mutex.h:136: warning: 'mutex_lock' declared inline after being called
 include/linux/mutex.h:136: warning: previous declaration of 'mutex_lock' was here

uninline it.

[ Impact: clean up and uninline, address compiler warning ]

Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Eric Paris &lt;eparis@redhat.com&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
LKML-Reference: &lt;200904292318.n3TNIsi6028340@imap1.linux-foundation.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>Merge branch 'linus' into perfcounters/core</title>
<updated>2009-04-29T12:47:05Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2009-04-29T12:46:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e7fd5d4b3d240f42c30a9e3d20a4689c4d3a795a'/>
<id>urn:sha1:e7fd5d4b3d240f42c30a9e3d20a4689c4d3a795a</id>
<content type='text'>
Merge reason: This brach was on -rc1, refresh it to almost-rc4 to pick up
              the latest upstream fixes.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>sched: remove extra call overhead for schedule()</title>
<updated>2009-04-20T18:49:53Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2009-03-13T11:21:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ff743345bf7685a207868048a70e23164c4785e5'/>
<id>urn:sha1:ff743345bf7685a207868048a70e23164c4785e5</id>
<content type='text'>
Lai Jiangshan's patch reminded me that I promised Nick to remove
that extra call overhead in schedule().

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
LKML-Reference: &lt;20090313112300.927414207@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<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>
</feed>
