This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 2/6] Fall back to locking if elision runs out of retries.
- From: Dominik Vogt <vogt at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 2 Sep 2013 09:59:47 +0200
- Subject: [PATCH 2/6] Fall back to locking if elision runs out of retries.
- Authentication-results: sourceware.org; auth=none
- References: <20130902075228 dot GA4792 at linux dot vnet dot ibm dot com>
- Reply-to: libc-alpha at sourceware dot org
With the old code, elision would never be disabled if every transaction aborts
with a temporary failure. This patch introduces a new configuration value that
is used whenever pthread_mutex_lock runs out of retries.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
>From 433efb398303d42acfe7c859ed4c62d8df9d306d Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@de.ibm.com>
Date: Mon, 2 Sep 2013 06:56:13 +0000
Subject: [PATCH 2/7] x86: Fall back to locking if elision runs out of
retries.
With the old code, elision would never be disabled if every transaction aborts
with a temporary failure.
---
nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c | 3 +++
nptl/sysdeps/unix/sysv/linux/x86/elision-conf.h | 1 +
nptl/sysdeps/unix/sysv/linux/x86/elision-lock.c | 4 ++++
3 files changed, 8 insertions(+)
diff --git a/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c b/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
index 2fed32b..c6bd49f 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
+++ b/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
@@ -35,6 +35,9 @@ struct elision_config __elision_aconf =
to reasons other than other threads' memory accesses. Expressed in
number of lock acquisition attempts. */
.skip_lock_internal_abort = 3,
+ /* How often to not attempt to use elision if a lock used up all retries
+ without success. Expressed in number of lock acquisition attempts. */
+ .skip_lock_out_of_retries = 3,
/* How often we retry using elision if there is chance for the transaction
to finish execution (e.g., it wasn't aborted due to the lock being
already acquired. */
diff --git a/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.h b/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.h
index 02cd2a6..1e519e9 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.h
@@ -28,6 +28,7 @@ struct elision_config
{
int skip_lock_busy;
int skip_lock_internal_abort;
+ int skip_lock_out_of_retries;
int retry_try_xbegin;
int skip_trylock_internal_abort;
};
diff --git a/nptl/sysdeps/unix/sysv/linux/x86/elision-lock.c b/nptl/sysdeps/unix/sysv/linux/x86/elision-lock.c
index 45370ed..04f7c28 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86/elision-lock.c
+++ b/nptl/sysdeps/unix/sysv/linux/x86/elision-lock.c
@@ -82,6 +82,10 @@ __lll_lock_elision (int *futex, short *adapt_count, EXTRAARG int private)
break;
}
}
+ /* Same logic as above, but for for a number of tepmorary failures in a
+ row. */
+ if (aconf.skip_lock_out_of_retries > 0 && aconf.retry_try_xbegin > 0)
+ *adapt_count = aconf.skip_lock_out_of_retries;
}
else
{
--
1.7.11.4