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: [PATCH][BZ #20973] Robust mutexes: Fix lost wake-up.


On Fri, 2016-12-16 at 15:11 +0100, Florian Weimer wrote:
> On 12/15/2016 11:29 PM, Torvald Riegel wrote:
> > diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
> > index bdfa529..01ac75e 100644
> > --- a/nptl/pthread_mutex_lock.c
> > +++ b/nptl/pthread_mutex_lock.c
> > @@ -182,6 +182,11 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
> >  		     &mutex->__data.__list.__next);
> >
> >        oldval = mutex->__data.__lock;
> > +      /* This is set to FUTEX_WAITERS iff we might have shared the
> 
> “iff” doesn't seem to be correct here because it's not an exact 
> equivalence, “if” is sufficient.

No, I think the iff is correct.  We do only set it if we may have shared
the flag.

> > @@ -190,9 +195,9 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
> >  	      /* The previous owner died.  Try locking the mutex.  */
> >  	      int newval = id;
> >  #ifdef NO_INCR
> > -	      newval |= FUTEX_WAITERS;
> > +	      newval |= FUTEX_WAITERS | assume_other_futex_waiters;
> >  #else
> > -	      newval |= (oldval & FUTEX_WAITERS);
> > +	      newval |= (oldval & FUTEX_WAITERS) | assume_other_futex_waiters;
> >  #endif
> 
> The NO_INCR change is quite confusing.  Perhaps drop it and add a comment?

Yes.

> VL, what is the copyright status of your test case?

So, I'll wait a little to see how the test case question resolved, and
then commit it with the one change above either with or without a test
case.  If anyone objects to that, please speak up.



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