This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 04/11] Add elision to pthread_mutex_{try,timed,un,}lock
- From: Andi Kleen <andi at firstfloor dot org>
- To: Torvald Riegel <triegel at redhat dot com>
- Cc: Andi Kleen <andi at firstfloor dot org>, libc-alpha at sourceware dot org, Andi Kleen <ak at linux dot jf dot intel dot com>
- Date: Fri, 14 Jun 2013 01:22:53 +0200
- Subject: Re: [PATCH 04/11] Add elision to pthread_mutex_{try,timed,un,}lock
- References: <1370969416-8337-1-git-send-email-andi at firstfloor dot org> <1370969416-8337-5-git-send-email-andi at firstfloor dot org> <1371140878 dot 16968 dot 19095 dot camel at triegel dot csb>
> > +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