This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.25-4-gdf3a4e1
- From: stli at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 6 Feb 2017 12:48:39 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.25-4-gdf3a4e1
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 df3a4e104fb63f96f05b29931dd83e272c2b7936 (commit)
from f2d7f23a300f57e36cd849ce80a93ccbcebd9968 (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=df3a4e104fb63f96f05b29931dd83e272c2b7936
commit df3a4e104fb63f96f05b29931dd83e272c2b7936
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date: Mon Feb 6 13:44:23 2017 +0100
Add __glibc_unlikely hint in lll_trylock, lll_cond_trylock.
The macros lll_trylock, lll_cond_trylock are extended by an __glibc_unlikely
hint. Now the trylock macros are based on the same assumption about a
free/busy lock as lll_lock.
With the hint gcc emits code in e.g. pthread_mutex_trylock which does
not use jumps if the lock is free. Without the hint it had to jump away
if the lock is free.
Tested on s390x, ppc.
ChangeLog:
* sysdeps/nptl/lowlevellock.h (lll_trylock, lll_cond_trylock):
Add __glibc_unlikely hint.
diff --git a/ChangeLog b/ChangeLog
index dd0a0b5..e4885cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-06 Stefan Liebler <stli@linux.vnet.ibm.com>
+
+ * sysdeps/nptl/lowlevellock.h (lll_trylock, lll_cond_trylock):
+ Add __glibc_unlikely hint.
+
2017-02-06 Adhemerval Zanella <adhemerval.zanella@linaro.org>
[BZ #16640]
diff --git a/sysdeps/nptl/lowlevellock.h b/sysdeps/nptl/lowlevellock.h
index 42d9658..54e3c28 100644
--- a/sysdeps/nptl/lowlevellock.h
+++ b/sysdeps/nptl/lowlevellock.h
@@ -64,13 +64,13 @@
0. Otherwise leave lock unchanged and return non-zero to indicate that the
lock was not acquired. */
#define lll_trylock(lock) \
- atomic_compare_and_exchange_bool_acq (&(lock), 1, 0)
+ __glibc_unlikely (atomic_compare_and_exchange_bool_acq (&(lock), 1, 0))
/* If LOCK is 0 (not acquired), set to 2 (acquired, possibly with waiters) and
return 0. Otherwise leave lock unchanged and return non-zero to indicate
that the lock was not acquired. */
#define lll_cond_trylock(lock) \
- atomic_compare_and_exchange_bool_acq (&(lock), 2, 0)
+ __glibc_unlikely (atomic_compare_and_exchange_bool_acq (&(lock), 2, 0))
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
sysdeps/nptl/lowlevellock.h | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
hooks/post-receive
--
GNU C Library master sources