about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/powerpc/elision-unlock.c')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/elision-unlock.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
index f04c339383..72b893d9f4 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;
 }