Re: [RFC] unify semaphore implementations

2005-04-29 Thread Paul Mackerras
I wrote: > The only fast path that needs atomic_dec_if_positive is down_trylock. > You can use atomic_dec for down_trylock instead; the only downside to > that is that if somebody was holding the semaphore but nobody was > waiting, the holder will take the slow path when it does the up. Better st

Re: [RFC] unify semaphore implementations

2005-04-29 Thread Paul Mackerras
Benjamin LaHaise writes: > There are at least two users who need asynchronous semaphore/mutex > operations: aio_write (which needs to acquire i_sem), and nfs. What do you mean by asynchronous semaphore/mutex operations? Are you talking about a down operation that will acquire the semaphore if

Re: [RFC] unify semaphore implementations

2005-04-29 Thread Paul Mackerras
Trond Myklebust writes: > 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 fast path that needs atomic_dec_if_positive is down_trylock. You can use atomic_dec for

Re: [RFC] unify semaphore implementations

2005-04-29 Thread Trond Myklebust
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 a

Re: [RFC] unify semaphore implementations

2005-04-29 Thread 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 im