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: [PATCHv3] PowerPC: Fix a race condition when eliding a lock


On Fri, Oct 09, 2015 at 10:30:47AM -0500, Paul E. Murphy wrote:
> 
> [Adding Andi if he has an opinion]
> 
> On 10/08/2015 10:54 AM, Torvald Riegel wrote:
> >> A busy lock likely indicates contention in the critical section which
> >> does not benefit from elision, I'd err on the side of a persistent
> >> failure.
> > 
> > I don't think I agree.  An already-acquired lock is something that could
> > be hit less likely by using elision more often on this lock (think about
> > the "lemming effect").
> > 
> 
> My line of thinking is that you are already experiencing the effect if
> a thread hits a taken lock. It most likely [1] implies adapt_count > 0,
> so you are guaranteed a time period of serialization. The best outcome is
> that you manage to run a transaction in between an actual lock. The worst
> being you extend the serialization period.

Lemming effects happens after the taken lock is freed. It prevents
speedy recovery into the parallel eliding state.

The typical way to improve Lemming is to wait for the lock
to become free before retrying. Unfortunately that is difficult
due to the way the glibc mutexes work, as there's no way to do
this with the futex interface. It would be possible to spin a bit,
but the code doesn't do that. But to do that you shouldn't do
a persistent abort, but keep going for a bit.

> 
> I think perhaps the best of both worlds might be to check the lock, and
> set the persistent bit if the lock is busy with waiters. Thoughts?

There's unfortunately nothing to check when you're experiencing the
Lemming effect. The other users just speculate on their own.

-Andi


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