mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Benjamin LaHaise <bcrl@kvack.org>
Cc: Paul Mackerras <paulus@samba.org>,
	linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] unify semaphore implementations
Date: Fri, 29 Apr 2005 11:42:00 -0400	[thread overview]
Message-ID: <1114789320.10086.81.camel@lade.trondhjem.org> (raw)
In-Reply-To: <20050429141437.GA24617@kvack.org>

fr den 29.04.2005 Klokka 10:14 (-0400) skreiv Benjamin LaHaise:
> On Fri, Apr 29, 2005 at 10:44:17AM +1000, Paul Mackerras wrote:
> > You have made semaphores bigger and slower on the architectures that
> > have load-linked/store-conditional instructions, which is at least
> > ppc, ppc64, sparc64 and alpha.  Did you take the trouble to understand
> > the ppc semaphore implementation?
> 
> The ppc implementation does have some good ideas that are worth using.  
> It's hard to know which of the 23 versions were worth using, but I'm 
> getting a picture where at least 2 variants are need.  The atomic ops 
> variant should use the single counter as ppc does (why did nobody port 
> that to x86?).  A spinlock version is needed at least by parisc.

The PPC implementation would be hard to port to x86, since it relies on
the load-linked/store-conditional stuff to provide a fast primitive for
atomic_dec_if_positive().
The only way I found to implement that on x86 was to use cmpxchg. On my
machine, therefore, a spinlock-based semaphore implementation turns out
to be at least as fast for the "fast" path (and is naturally much more
efficient for the slow path).

Cheers,
  Trond

-- 
Trond Myklebust <trond.myklebust@fys.uio.no>


  reply	other threads:[~2005-04-29 15:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-28 18:29 Benjamin LaHaise
2005-04-28 18:48 ` James Bottomley
2005-04-28 18:59   ` Benjamin LaHaise
2005-04-28 18:53     ` David S. Miller
2005-04-28 22:40 ` Russell King
2005-04-29  0:42   ` Trond Myklebust
2005-04-29  1:26     ` Paul Mackerras
2005-04-28 22:54 ` David Howells
2005-04-29  0:44 ` Paul Mackerras
2005-04-29  5:33   ` Richard Henderson
2005-04-29 14:14   ` Benjamin LaHaise
2005-04-29 15:42     ` Trond Myklebust [this message]
2005-04-30  1:45       ` Paul Mackerras
2005-04-30  5:13         ` Paul Mackerras
2005-04-30 16:40         ` Trond Myklebust
2005-04-30  1:49     ` Paul Mackerras
2005-04-30 16:50       ` Trond Myklebust

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=1114789320.10086.81.camel@lade.trondhjem.org \
    --to=trond.myklebust@fys.uio.no \
    --cc=bcrl@kvack.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    /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

all inboxes | Powered by JetHome®