8ae002
commit b0a3c1640ab2fb7d16d9b9a8d9c0e524e9cb0001
8ae002
Author: Andreas Schwab <schwab@suse.de>
8ae002
Date:   Tue Mar 4 13:00:26 2014 +0100
8ae002
8ae002
    Properly handle forced elision in pthread_mutex_trylock (bug 16657)
8ae002
8ae002
Index: glibc-2.17-c758a686/nptl/pthread_mutex_trylock.c
8ae002
===================================================================
8ae002
--- glibc-2.17-c758a686.orig/nptl/pthread_mutex_trylock.c
8ae002
+++ glibc-2.17-c758a686/nptl/pthread_mutex_trylock.c
8ae002
@@ -26,8 +26,8 @@
8ae002
 #define lll_trylock_elision(a,t) lll_trylock(a)
8ae002
 #endif
8ae002
 
8ae002
-#ifndef DO_ELISION
8ae002
-#define DO_ELISION(m) 0
8ae002
+#ifndef FORCE_ELISION
8ae002
+#define FORCE_ELISION(m, s)
8ae002
 #endif
8ae002
 
8ae002
 /* We don't force elision in trylock, because this can lead to inconsistent
8ae002
@@ -69,7 +69,7 @@ __pthread_mutex_trylock (mutex)
8ae002
       break;
8ae002
 
8ae002
     case PTHREAD_MUTEX_TIMED_ELISION_NP:
8ae002
-    elision:
8ae002
+    elision: __attribute__((unused))
8ae002
       if (lll_trylock_elision (mutex->__data.__lock,
8ae002
 			       mutex->__data.__elision) != 0)
8ae002
         break;
8ae002
@@ -77,8 +77,7 @@ __pthread_mutex_trylock (mutex)
8ae002
       return 0;
8ae002
 
8ae002
     case PTHREAD_MUTEX_TIMED_NP:
8ae002
-      if (DO_ELISION (mutex))
8ae002
-	goto elision;
8ae002
+      FORCE_ELISION (mutex, goto elision);
8ae002
       /*FALL THROUGH*/
8ae002
     case PTHREAD_MUTEX_ADAPTIVE_NP:
8ae002
     case PTHREAD_MUTEX_ERRORCHECK_NP:
8ae002
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h
8ae002
===================================================================
8ae002
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h
8ae002
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h
8ae002
@@ -16,11 +16,6 @@
8ae002
    License along with the GNU C Library; if not, see
8ae002
    <http://www.gnu.org/licenses/>.  */
8ae002
 
8ae002
-/* Check for elision on this lock without upgrading.  */
8ae002
-#define DO_ELISION(m)							\
8ae002
-  (__pthread_force_elision						\
8ae002
-   && (m->__data.__kind & PTHREAD_MUTEX_NO_ELISION_NP) == 0)		\
8ae002
-
8ae002
 /* Automatically enable elision for existing user lock kinds.  */
8ae002
 #define FORCE_ELISION(m, s)						\
8ae002
   if (__pthread_force_elision						\