public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/users/skpgkp2/2.33/master] Avoid extra load with CAS in __pthread_mutex_lock_full [BZ #28537]
@ 2022-09-28 19:10 Sunil Pandey
0 siblings, 0 replies; 3+ messages in thread
From: Sunil Pandey @ 2022-09-28 19:10 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b62b86cf12fa1484d1952bedb2856860030d6cc0
commit b62b86cf12fa1484d1952bedb2856860030d6cc0
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Nov 11 06:31:51 2021 -0800
Avoid extra load with CAS in __pthread_mutex_lock_full [BZ #28537]
Replace boolean CAS with value CAS to avoid the extra load.
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
(cherry picked from commit 0b82747dc48d5bf0871bdc6da8cb6eec1256355f)
Diff:
---
nptl/pthread_mutex_lock.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index 319658adc4..0fd7467b97 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -289,12 +289,12 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
meantime. */
if ((oldval & FUTEX_WAITERS) == 0)
{
- if (atomic_compare_and_exchange_bool_acq (&mutex->__data.__lock,
- oldval | FUTEX_WAITERS,
- oldval)
- != 0)
+ int val;
+ if ((val = atomic_compare_and_exchange_val_acq
+ (&mutex->__data.__lock, oldval | FUTEX_WAITERS,
+ oldval)) != oldval)
{
- oldval = mutex->__data.__lock;
+ oldval = val;
continue;
}
oldval |= FUTEX_WAITERS;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [glibc/users/skpgkp2/2.33/master] Avoid extra load with CAS in __pthread_mutex_lock_full [BZ #28537]
@ 2022-09-29 18:41 Sunil Pandey
0 siblings, 0 replies; 3+ messages in thread
From: Sunil Pandey @ 2022-09-29 18:41 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f5a70409db67f3a5f035d9d6082d11efcc74910d
commit f5a70409db67f3a5f035d9d6082d11efcc74910d
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Nov 11 06:31:51 2021 -0800
Avoid extra load with CAS in __pthread_mutex_lock_full [BZ #28537]
Replace boolean CAS with value CAS to avoid the extra load.
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
(cherry picked from commit 0b82747dc48d5bf0871bdc6da8cb6eec1256355f)
Diff:
---
nptl/pthread_mutex_lock.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index 319658adc4..0fd7467b97 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -289,12 +289,12 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
meantime. */
if ((oldval & FUTEX_WAITERS) == 0)
{
- if (atomic_compare_and_exchange_bool_acq (&mutex->__data.__lock,
- oldval | FUTEX_WAITERS,
- oldval)
- != 0)
+ int val;
+ if ((val = atomic_compare_and_exchange_val_acq
+ (&mutex->__data.__lock, oldval | FUTEX_WAITERS,
+ oldval)) != oldval)
{
- oldval = mutex->__data.__lock;
+ oldval = val;
continue;
}
oldval |= FUTEX_WAITERS;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [glibc/users/skpgkp2/2.33/master] Avoid extra load with CAS in __pthread_mutex_lock_full [BZ #28537]
@ 2022-09-28 21:45 Sunil Pandey
0 siblings, 0 replies; 3+ messages in thread
From: Sunil Pandey @ 2022-09-28 21:45 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f1cacf918a2f47cb6d1dcea43a960eaf3cb49ad2
commit f1cacf918a2f47cb6d1dcea43a960eaf3cb49ad2
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Nov 11 06:31:51 2021 -0800
Avoid extra load with CAS in __pthread_mutex_lock_full [BZ #28537]
Replace boolean CAS with value CAS to avoid the extra load.
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
(cherry picked from commit 0b82747dc48d5bf0871bdc6da8cb6eec1256355f)
Diff:
---
nptl/pthread_mutex_lock.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index 319658adc4..0fd7467b97 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -289,12 +289,12 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
meantime. */
if ((oldval & FUTEX_WAITERS) == 0)
{
- if (atomic_compare_and_exchange_bool_acq (&mutex->__data.__lock,
- oldval | FUTEX_WAITERS,
- oldval)
- != 0)
+ int val;
+ if ((val = atomic_compare_and_exchange_val_acq
+ (&mutex->__data.__lock, oldval | FUTEX_WAITERS,
+ oldval)) != oldval)
{
- oldval = mutex->__data.__lock;
+ oldval = val;
continue;
}
oldval |= FUTEX_WAITERS;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-29 18:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 19:10 [glibc/users/skpgkp2/2.33/master] Avoid extra load with CAS in __pthread_mutex_lock_full [BZ #28537] Sunil Pandey
2022-09-28 21:45 Sunil Pandey
2022-09-29 18:41 Sunil Pandey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).