GNU C Library master sources branch master updated. glibc-2.22-406-gfadd2ad

tuliom@sourceware.org tuliom@sourceware.org
Thu Oct 15 21:57:00 GMT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  fadd2ad9cc36115440d50b0eae9299e65988917d (commit)
       via  e5e6bea22a2939fe7c415a375992f3ca19f9ff2e (commit)
      from  3c82bb5042330441a18fd8e8d5b74d25d5540a66 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=fadd2ad9cc36115440d50b0eae9299e65988917d

commit fadd2ad9cc36115440d50b0eae9299e65988917d
Author: Paul Murphy <murphyp@linux.vnet.ibm.com>
Date:   Thu Sep 3 13:40:21 2015 -0500

    powerpc: Optimize lock elision for pthread_mutex_t
    
    With TLE enabled, the adapt count variable update incurs
    an 8% overhead before entering the critical section of an
    elided mutex.
    
    Instead, if it is done right after leaving the critical
    section, this serialization can be avoided.
    
    This alters the existing behavior of __lll_trylock_elision
    as it will only decrement the adapt_count if it successfully
    acquires the lock.
    
    	* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
    	(__lll_lock_elision): Remove adapt_count decrement...
    	* sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
    	(__lll_trylock_elision): Likewise.
    	* sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
    	(__lll_unlock_elision): ... to here. And utilize
    	new adapt_count parameter.
    	* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
    	(__lll_unlock_elision): Update to include adapt_count
    	parameter.
    	(lll_unlock_elision): Pass pointer to adapt_count
    	variable.

diff --git a/ChangeLog b/ChangeLog
index 6a743e4..917c464 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2015-10-15  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
+	* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
+	(__lll_lock_elision): Remove adapt_count decrement...
+	* sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
+	(__lll_trylock_elision): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
+	(__lll_unlock_elision): ... to here. And utilize
+	new adapt_count parameter.
+	* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+	(__lll_unlock_elision): Update to include adapt_count
+	parameter.
+	(lll_unlock_elision): Pass pointer to adapt_count
+	variable.
+
+2015-10-15  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
 	* nptl/pthread_mutex_unlock.c (lll_unlock_elision):
 	Add elision adapt_count parameter to list of arguments.
 	* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
index 26d272e..3762732 100644
--- a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
+++ b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
@@ -47,7 +47,6 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
 {
   if (*adapt_count > 0)
     {
-      (*adapt_count)--;
       goto use_lock;
     }
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c b/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
index 7b6d1b9..440939c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
+++ b/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
@@ -36,7 +36,6 @@ __lll_trylock_elision (int *futex, short *adapt_count)
   /* Only try a transaction if it's worth it.  */
   if (*adapt_count > 0)
     {
-      (*adapt_count)--;
       goto use_lock;
     }
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
index f04c339..72b893d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
+++ b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
@@ -21,12 +21,20 @@
 #include "htm.h"
 
 int
-__lll_unlock_elision(int *lock, int pshared)
+__lll_unlock_elision (int *lock, short *adapt_count, int pshared)
 {
   /* When the lock was free we're in a transaction.  */
   if (*lock == 0)
     __builtin_tend (0);
   else
-    lll_unlock ((*lock), pshared);
+    {
+      lll_unlock ((*lock), pshared);
+
+      /* Update the adapt count AFTER completing the critical section.
+         Doing this here prevents unneeded stalling when entering
+         a critical section.  Saving about 8% runtime on P8.  */
+      if (*adapt_count > 0)
+	(*adapt_count)--;
+    }
   return 0;
 }
diff --git a/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
index 16479e7..6769c25 100644
--- a/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+++ b/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
@@ -32,7 +32,7 @@ extern int __lll_timedlock_elision
 extern int __lll_lock_elision (int *futex, short *adapt_count, int private)
   attribute_hidden;
 
-extern int __lll_unlock_elision(int *lock, int private)
+extern int __lll_unlock_elision (int *lock, short *adapt_count, int private)
   attribute_hidden;
 
 extern int __lll_trylock_elision(int *lock, short *adapt_count)
@@ -41,7 +41,7 @@ extern int __lll_trylock_elision(int *lock, short *adapt_count)
 #define lll_lock_elision(futex, adapt_count, private) \
   __lll_lock_elision (&(futex), &(adapt_count), private)
 #define lll_unlock_elision(futex, adapt_count, private) \
-  __lll_unlock_elision (&(futex), private)
+  __lll_unlock_elision (&(futex), &(adapt_count), private)
 #define lll_trylock_elision(futex, adapt_count) \
   __lll_trylock_elision (&(futex), &(adapt_count))
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e5e6bea22a2939fe7c415a375992f3ca19f9ff2e

commit e5e6bea22a2939fe7c415a375992f3ca19f9ff2e
Author: Paul Murphy <murphyp@linux.vnet.ibm.com>
Date:   Thu Sep 3 13:40:11 2015 -0500

    nptl: Add adapt_count parameter to lll_unlock_elision
    
    Adding this parameter will give architectures more freedom in
    how they choose to update this variable.  This change has no
    effect on architectures which choose not to use it.
    
    	* nptl/pthread_mutex_unlock.c(lll_unlock_elision):
    	Add elision adapt_count parameter to list of arguments.
    	* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
    	(lll_unlock_elision): Update with new parameter list
    	* sysdeps/unix/sysv/linux/s390/lowlevellock.h
    	(lll_unlock_elision): Likewise
    	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
    	(lll_unlock_elision): Likewise

diff --git a/ChangeLog b/ChangeLog
index 0261e66..6a743e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-10-15  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
+	* nptl/pthread_mutex_unlock.c (lll_unlock_elision):
+	Add elision adapt_count parameter to list of arguments.
+	* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+	(lll_unlock_elision): Update with new parameter list
+	* sysdeps/unix/sysv/linux/s390/lowlevellock.h
+	(lll_unlock_elision): Likewise
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+	(lll_unlock_elision): Likewise
+
 2015-10-15  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #19122]
diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c
index 80939ba..9e864c1 100644
--- a/nptl/pthread_mutex_unlock.c
+++ b/nptl/pthread_mutex_unlock.c
@@ -24,7 +24,7 @@
 #include <stap-probe.h>
 
 #ifndef lll_unlock_elision
-#define lll_unlock_elision(a,b) ({ lll_unlock (a,b); 0; })
+#define lll_unlock_elision(a,b,c) ({ lll_unlock (a,c); 0; })
 #endif
 
 static int
@@ -63,7 +63,7 @@ __pthread_mutex_unlock_usercnt (mutex, decr)
   else if (__glibc_likely (type == PTHREAD_MUTEX_TIMED_ELISION_NP))
     {
       /* Don't reset the owner/users fields for elision.  */
-      return lll_unlock_elision (mutex->__data.__lock,
+      return lll_unlock_elision (mutex->__data.__lock, mutex->__data.__elision,
 				      PTHREAD_MUTEX_PSHARED (mutex));
     }
   else if (__builtin_expect (PTHREAD_MUTEX_TYPE (mutex)
diff --git a/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
index 67db1de..16479e7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+++ b/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
@@ -40,7 +40,7 @@ extern int __lll_trylock_elision(int *lock, short *adapt_count)
 
 #define lll_lock_elision(futex, adapt_count, private) \
   __lll_lock_elision (&(futex), &(adapt_count), private)
-#define lll_unlock_elision(futex, private) \
+#define lll_unlock_elision(futex, adapt_count, private) \
   __lll_unlock_elision (&(futex), private)
 #define lll_trylock_elision(futex, adapt_count) \
   __lll_trylock_elision (&(futex), &(adapt_count))
diff --git a/sysdeps/unix/sysv/linux/s390/lowlevellock.h b/sysdeps/unix/sysv/linux/s390/lowlevellock.h
index 163a731..cab5f4c 100644
--- a/sysdeps/unix/sysv/linux/s390/lowlevellock.h
+++ b/sysdeps/unix/sysv/linux/s390/lowlevellock.h
@@ -41,7 +41,7 @@ extern int __lll_trylock_elision(int *futex, short *adapt_count)
 
 #  define lll_lock_elision(futex, adapt_count, private) \
   __lll_lock_elision (&(futex), &(adapt_count), private)
-#  define lll_unlock_elision(futex, private) \
+#  define lll_unlock_elision(futex, adapt_count, private) \
   __lll_unlock_elision (&(futex), private)
 #  define lll_trylock_elision(futex, adapt_count) \
   __lll_trylock_elision(&(futex), &(adapt_count))
diff --git a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
index de525cd..1fbd31e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+++ b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
@@ -342,7 +342,7 @@ extern int __lll_trylock_elision (int *lock, short *adapt_count)
 
 #define lll_lock_elision(futex, adapt_count, private) \
   __lll_lock_elision (&(futex), &(adapt_count), private)
-#define lll_unlock_elision(futex, private) \
+#define lll_unlock_elision(futex, adapt_count, private) \
   __lll_unlock_elision (&(futex), private)
 #define lll_trylock_elision(futex, adapt_count) \
   __lll_trylock_elision (&(futex), &(adapt_count))

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                         |   26 +++++++++++++++++++++
 nptl/pthread_mutex_unlock.c                       |    4 +-
 sysdeps/unix/sysv/linux/powerpc/elision-lock.c    |    1 -
 sysdeps/unix/sysv/linux/powerpc/elision-trylock.c |    1 -
 sysdeps/unix/sysv/linux/powerpc/elision-unlock.c  |   12 ++++++++-
 sysdeps/unix/sysv/linux/powerpc/lowlevellock.h    |    6 ++--
 sysdeps/unix/sysv/linux/s390/lowlevellock.h       |    2 +-
 sysdeps/unix/sysv/linux/x86_64/lowlevellock.h     |    2 +-
 8 files changed, 43 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources



More information about the Glibc-cvs mailing list