[PATCH 04/11] Add elision to pthread_mutex_{try,timed,un,}lock
Andi Kleen
andi@firstfloor.org
Thu Jun 13 23:22:00 GMT 2013
> > +static inline __attribute__((always_inline)) void
> > +adaptive_lock (pthread_mutex_t *mutex)
> > +{
> > + if (! __is_smp)
> > + return;
>
> How can this be correct? Depending on __is_smp, we either return with
> an acquired lock or without. The original code called the following in
> case of ! __is_smp:
> /* Normal mutex. */
> LLL_MUTEX_LOCK (mutex);
> assert (mutex->__data.__owner == 0);
Good catch. I fixed this now.
BTW looking at the is_smp_system() code it would really surprise me
if this variable was ever set on a modern system. Maybe it should
be just removed.
It checks for UP kernels which noone really uses anymore.
-Andi
More information about the Libc-alpha
mailing list