From: David Howells <dhowells@redhat.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Anton Blanchard <anton@samba.org>,
jes@trained-monkey.org, rmk+lkml@arm.linux.org.uk, ak@suse.de,
linux-kernel@vger.kernel.org, hch@infradead.org,
torvalds@osdl.org, viro@ftp.linux.org.uk,
linuxppc64-dev@ozlabs.org, mingo@elte.hu, nico@cam.org,
oleg@tv-sign.ru, alan@lxorguk.ukuu.org.uk, arjan@infradead.org
Subject: Re: PowerPC fastpaths for mutex subsystem
Date: Mon, 09 Jan 2006 11:13:52 +0000 [thread overview]
Message-ID: <923.1136805232@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <20060108000021.588c6f5f.akpm@osdl.org>
Andrew Morton <akpm@osdl.org> wrote:
> > Wasnt most of the x86 mutex gain a result of going from fair to unfair
> > operation? The current ppc64 semaphores are unfair.
> >
>
> What's "unfair"? Mutexes are FIFO, as are x86 semaphores.
No, strictly Ingo's mutexes are neither completely fair nor completely FIFO.
It's possible for a process to jump the queue because unlock() always sets the
counter back to 1 before waking up the process at the front of the queue. This
means that the lock() fastpath in another process may steal the mutex out of
sequence before the wakee has a chance to grab it.
I'm not 100% convinced that x86 counting semaphores are completely fair or
completely FIFO. It's possible that they are because up() never arbitrarily
sets the count back to >0.
R/W semaphores are completely fair, but only as completely FIFO as the unfair
spinlocks permit. This is because it's much easier to guarantee their behaviour
(writer-starvation is a real problem with unfair rwsems). I have a simple
implementation of totally fair spinlocks for x86 which would also work on
anything that can emulate XADD, but I don't think it's worth the trouble.
However, for Ingo's mutexes, I suspect this queue-jumping feature is
sufficiently low probability that we can ignore it. It is theoretically
possible to induce livelock, but in reality I think it extremely unlikely to
happen for any significant length of time.
David
next prev parent reply other threads:[~2006-01-09 11:15 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-04 14:41 [patch 00/21] mutex subsystem, -V14 Ingo Molnar
2006-01-04 23:45 ` Joel Schopp
2006-01-05 2:38 ` Nicolas Pitre
2006-01-05 2:51 ` Linus Torvalds
2006-01-05 3:21 ` Nick Piggin
2006-01-05 3:39 ` Anton Blanchard
2006-01-05 18:04 ` Jesse Barnes
2006-01-05 14:40 ` Ingo Molnar
2006-01-05 16:21 ` Linus Torvalds
2006-01-05 22:03 ` Ingo Molnar
2006-01-05 22:17 ` Linus Torvalds
2006-01-05 22:43 ` Ingo Molnar
2006-01-06 3:49 ` Keith Owens
2006-01-06 7:34 ` Denis Vlasenko
2006-01-05 14:35 ` Ingo Molnar
2006-01-05 16:42 ` Joel Schopp
2006-01-05 22:21 ` Ingo Molnar
2006-01-05 23:06 ` Joel Schopp
2006-01-05 23:26 ` Linus Torvalds
2006-01-05 23:36 ` Joel Schopp
2006-01-05 23:42 ` Ingo Molnar
2006-01-06 0:29 ` Olof Johansson
2006-01-07 17:49 ` PowerPC fastpaths for mutex subsystem Joel Schopp
2006-01-07 22:37 ` Andrew Morton
2006-01-08 7:43 ` Anton Blanchard
2006-01-08 8:00 ` Andrew Morton
2006-01-08 8:23 ` Anton Blanchard
2006-01-09 11:13 ` David Howells [this message]
2006-01-08 9:48 ` Ingo Molnar
2006-01-10 22:31 ` Joel Schopp
2006-01-10 23:09 ` Ingo Molnar
2006-01-11 10:52 ` Ingo Molnar
2006-01-11 17:44 ` Joel Schopp
2006-01-08 10:43 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=923.1136805232@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=anton@samba.org \
--cc=arjan@infradead.org \
--cc=hch@infradead.org \
--cc=jes@trained-monkey.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc64-dev@ozlabs.org \
--cc=mingo@elte.hu \
--cc=nico@cam.org \
--cc=oleg@tv-sign.ru \
--cc=rmk+lkml@arm.linux.org.uk \
--cc=torvalds@osdl.org \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox