Blame SOURCES/glibc-sw28537-2.patch
|
|
190885 |
From 56212a35fe258f45f242f4bb80866e4980e4ec0e Mon Sep 17 00:00:00 2001
|
|
|
190885 |
From: "H.J. Lu" <hjl.tools@gmail.com>
|
|
|
190885 |
Date: Thu, 11 Nov 2021 06:54:01 -0800
|
|
|
190885 |
Subject: [PATCH] Avoid extra load with CAS in __pthread_mutex_clocklock_common
|
|
|
190885 |
[BZ #28537]
|
|
|
190885 |
|
|
|
190885 |
Replace boolean CAS with value CAS to avoid the extra load.
|
|
|
190885 |
|
|
|
190885 |
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
|
|
|
190885 |
(cherry picked from commit 49302b8fdf9103b6fc0a398678668a22fa19574c)
|
|
|
190885 |
---
|
|
|
190885 |
nptl/pthread_mutex_timedlock.c | 10 +++++-----
|
|
|
190885 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
190885 |
|
|
|
190885 |
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
|
|
|
190885 |
index 888c12fe..c4627ef6 100644
|
|
|
190885 |
--- a/nptl/pthread_mutex_timedlock.c
|
|
|
190885 |
+++ b/nptl/pthread_mutex_timedlock.c
|
|
|
190885 |
@@ -269,12 +269,12 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex,
|
|
|
190885 |
meantime. */
|
|
|
190885 |
if ((oldval & FUTEX_WAITERS) == 0)
|
|
|
190885 |
{
|
|
|
190885 |
- if (atomic_compare_and_exchange_bool_acq (&mutex->__data.__lock,
|
|
|
190885 |
- oldval | FUTEX_WAITERS,
|
|
|
190885 |
- oldval)
|
|
|
190885 |
- != 0)
|
|
|
190885 |
+ int val;
|
|
|
190885 |
+ if ((val = atomic_compare_and_exchange_val_acq
|
|
|
190885 |
+ (&mutex->__data.__lock, oldval | FUTEX_WAITERS,
|
|
|
190885 |
+ oldval)) != oldval)
|
|
|
190885 |
{
|
|
|
190885 |
- oldval = mutex->__data.__lock;
|
|
|
190885 |
+ oldval = val;
|
|
|
190885 |
continue;
|
|
|
190885 |
}
|
|
|
190885 |
oldval |= FUTEX_WAITERS;
|
|
|
190885 |
--
|
|
|
190885 |
GitLab
|
|
|
190885 |
|