This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCHv2] powerpc: Spinlock optimization and cleanup


On Thu, Oct 01, 2015 at 09:17:06PM +0200, Torvald Riegel wrote:
> > (the issue is that for correct pthread_spin_trylock behavior
> > the lock should be seqcst instead of acquire and the unlock
> > should be release instead of barrier+store otherwise trylock
> > can spuriously report locked state).
> 
> Right now, unlock is a full barrier (ie, seqcst) plus store.  That is
> stronger than a release store.  Also note that a failing POSIX
> synchronization function is not supposed to synchronize memory.  So, a
> failing trylock doesn't help a program unless it synchronizes through
> some other way, in which case this other way will "provide" the
> barriers.

As always, the issue is not whether it synchronizes memory on failure,
but whether it can accurately determine whether to fail or not without
synchronizing memory. The latter is an implementation detail of
course, but in practice you can't make this determination without
synchronizing memory.

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]