aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
authorPaul Murphy <murphyp@linux.vnet.ibm.com>2015-08-27 09:48:04 -0500
committerTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>2015-10-27 17:27:41 -0200
commit72f1463df85a522bfd1568e47bd81371522ee358 (patch)
treea257dcbec150b619574c29326f89ee10d013891f /sysdeps/unix/sysv/linux
parent76c5ae00284d98f1994434c570bdcde9dbc6b49e (diff)
downloadglibc-72f1463df85a522bfd1568e47bd81371522ee358.zip
glibc-72f1463df85a522bfd1568e47bd81371522ee358.tar.gz
glibc-72f1463df85a522bfd1568e47bd81371522ee358.tar.bz2
powerpc: Fix usage of elision transient failure adapt param
The skip_lock_out_of_tbegin_retries adaptive parameter was not being used correctly, nor as described. This prevents a fallback for all users of the lock if a transient abort occurs within the accepted number of retries. [BZ #19174] * sysdeps/powerpc/nptl/elide.h (__elide_lock): Fix usage of .skip_lock_out_of_tbegin_retries. * sysdeps/unix/sysv/linux/powerpc/elision-lock.c (__lll_lock_elision): Likewise, and respect a value of try_tbegin <= 0.
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/elision-lock.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
index 3762732..4775fca 100644
--- a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
+++ b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
@@ -50,8 +50,7 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
goto use_lock;
}
- int try_begin = aconf.try_tbegin;
- while (1)
+ for (int i = aconf.try_tbegin; i > 0; i--)
{
if (__builtin_tbegin (0))
{
@@ -65,21 +64,19 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
/* A persistent failure indicates that a retry will probably
result in another failure. Use normal locking now and
for the next couple of calls. */
- if (try_begin-- <= 0
- || _TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
+ if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
{
if (aconf.skip_lock_internal_abort > 0)
*adapt_count = aconf.skip_lock_internal_abort;
goto use_lock;
}
- /* Same logic as above, but for for a number of temporary failures
- in a row. */
- else if (aconf.skip_lock_out_of_tbegin_retries > 0
- && aconf.try_tbegin > 0)
- *adapt_count = aconf.skip_lock_out_of_tbegin_retries;
}
}
+ /* Fall back to locks for a bit if retries have been exhausted */
+ if (aconf.try_tbegin > 0 && aconf.skip_lock_out_of_tbegin_retries > 0)
+ *adapt_count = aconf.skip_lock_out_of_tbegin_retries;
+
use_lock:
return LLL_LOCK ((*lock), pshared);
}