public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/futex-refactor] linux: nptl: Remove _futex_clock_wait_bitset64
@ 2020-11-23 21:07 Adhemerval Zanella
  0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2020-11-23 21:07 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d300f941a87861f1ef9f5b844b46316112587ca1

commit d300f941a87861f1ef9f5b844b46316112587ca1
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sat Nov 21 11:40:46 2020 -0300

    linux: nptl: Remove _futex_clock_wait_bitset64
    
    It can be replaced with a __futex_abstimed_wait64 call.
    
    Checked on x86_64-linux-gnu and i686-linux-gnu.

Diff:
---
 nptl/pthread_mutex_timedlock.c |  7 ++++---
 sysdeps/nptl/futex-internal.c  | 46 ------------------------------------------
 sysdeps/nptl/futex-internal.h  |  5 -----
 3 files changed, 4 insertions(+), 54 deletions(-)

diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index de88e9fc25..0ec47359be 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -265,12 +265,13 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
 	  assume_other_futex_waiters |= FUTEX_WAITERS;
 
 	  /* Block using the futex.  */
-	  int err = __futex_clock_wait_bitset64 (&mutex->__data.__lock,
+	  int err = __futex_abstimed_wait64 (
+	      (unsigned int *) &mutex->__data.__lock,
 	      oldval, clockid, abstime,
 	      PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
 	  /* The futex call timed out.  */
-	  if (err == -ETIMEDOUT)
-	    return -err;
+	  if (err == ETIMEDOUT)
+	    return err;
 	  /* Reload current lock value.  */
 	  oldval = mutex->__data.__lock;
 	}
diff --git a/sysdeps/nptl/futex-internal.c b/sysdeps/nptl/futex-internal.c
index f9a2e28ee6..30c662547f 100644
--- a/sysdeps/nptl/futex-internal.c
+++ b/sysdeps/nptl/futex-internal.c
@@ -48,27 +48,6 @@ __futex_abstimed_wait_common32 (unsigned int* futex_word,
                                   pts32, NULL /* Unused.  */,
                                   FUTEX_BITSET_MATCH_ANY);
 }
-
-static int
-__futex_clock_wait_bitset32 (int *futexp, int val, clockid_t clockid,
-                             const struct __timespec64 *abstime, int private)
-{
-  struct timespec ts32;
-
-  if (abstime != NULL && ! in_time_t_range (abstime->tv_sec))
-    return -EOVERFLOW;
-
-  const unsigned int clockbit =
-    (clockid == CLOCK_REALTIME) ? FUTEX_CLOCK_REALTIME : 0;
-  const int op = __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private);
-
-  if (abstime != NULL)
-    ts32 = valid_timespec64_to_timespec (*abstime);
-
-  return INTERNAL_SYSCALL_CALL (futex, futexp, op, val,
-                                abstime != NULL ? &ts32 : NULL,
-                                NULL /* Unused.  */, FUTEX_BITSET_MATCH_ANY);
-}
 #endif /* ! __ASSUME_TIME64_SYSCALLS */
 
 static int
@@ -198,28 +177,3 @@ __futex_clocklock_wait64 (int *futex, int val, clockid_t clockid,
 
   return -err;
 }
-
-int
-__futex_clock_wait_bitset64 (int *futexp, int val, clockid_t clockid,
-                             const struct __timespec64 *abstime,
-                             int private)
-{
-  int ret;
-  if (! lll_futex_supported_clockid (clockid))
-    {
-      return -EINVAL;
-    }
-
-  const unsigned int clockbit =
-    (clockid == CLOCK_REALTIME) ? FUTEX_CLOCK_REALTIME : 0;
-  const int op = __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private);
-
-  ret = INTERNAL_SYSCALL_CALL (futex_time64, futexp, op, val,
-                               abstime, NULL /* Unused.  */,
-                               FUTEX_BITSET_MATCH_ANY);
-#ifndef __ASSUME_TIME64_SYSCALLS
-  if (ret == -ENOSYS)
-    ret = __futex_clock_wait_bitset32 (futexp, val, clockid, abstime, private);
-#endif
-  return ret;
-}
diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h
index cefab74301..dcc7958d59 100644
--- a/sysdeps/nptl/futex-internal.h
+++ b/sysdeps/nptl/futex-internal.h
@@ -440,9 +440,4 @@ __futex_clocklock64 (int *futex, clockid_t clockid,
   return err;
 }
 
-int
-__futex_clock_wait_bitset64 (int *futexp, int val, clockid_t clockid,
-                             const struct __timespec64 *abstime,
-                             int private) attribute_hidden;
-
 #endif  /* futex-internal.h */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [glibc/azanella/futex-refactor] linux: nptl: Remove _futex_clock_wait_bitset64
@ 2020-11-23 20:48 Adhemerval Zanella
  0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2020-11-23 20:48 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d300f941a87861f1ef9f5b844b46316112587ca1

commit d300f941a87861f1ef9f5b844b46316112587ca1
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sat Nov 21 11:40:46 2020 -0300

    linux: nptl: Remove _futex_clock_wait_bitset64
    
    It can be replaced with a __futex_abstimed_wait64 call.
    
    Checked on x86_64-linux-gnu and i686-linux-gnu.

Diff:
---
 nptl/pthread_mutex_timedlock.c |  7 ++++---
 sysdeps/nptl/futex-internal.c  | 46 ------------------------------------------
 sysdeps/nptl/futex-internal.h  |  5 -----
 3 files changed, 4 insertions(+), 54 deletions(-)

diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index de88e9fc25..0ec47359be 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -265,12 +265,13 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
 	  assume_other_futex_waiters |= FUTEX_WAITERS;
 
 	  /* Block using the futex.  */
-	  int err = __futex_clock_wait_bitset64 (&mutex->__data.__lock,
+	  int err = __futex_abstimed_wait64 (
+	      (unsigned int *) &mutex->__data.__lock,
 	      oldval, clockid, abstime,
 	      PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
 	  /* The futex call timed out.  */
-	  if (err == -ETIMEDOUT)
-	    return -err;
+	  if (err == ETIMEDOUT)
+	    return err;
 	  /* Reload current lock value.  */
 	  oldval = mutex->__data.__lock;
 	}
diff --git a/sysdeps/nptl/futex-internal.c b/sysdeps/nptl/futex-internal.c
index f9a2e28ee6..30c662547f 100644
--- a/sysdeps/nptl/futex-internal.c
+++ b/sysdeps/nptl/futex-internal.c
@@ -48,27 +48,6 @@ __futex_abstimed_wait_common32 (unsigned int* futex_word,
                                   pts32, NULL /* Unused.  */,
                                   FUTEX_BITSET_MATCH_ANY);
 }
-
-static int
-__futex_clock_wait_bitset32 (int *futexp, int val, clockid_t clockid,
-                             const struct __timespec64 *abstime, int private)
-{
-  struct timespec ts32;
-
-  if (abstime != NULL && ! in_time_t_range (abstime->tv_sec))
-    return -EOVERFLOW;
-
-  const unsigned int clockbit =
-    (clockid == CLOCK_REALTIME) ? FUTEX_CLOCK_REALTIME : 0;
-  const int op = __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private);
-
-  if (abstime != NULL)
-    ts32 = valid_timespec64_to_timespec (*abstime);
-
-  return INTERNAL_SYSCALL_CALL (futex, futexp, op, val,
-                                abstime != NULL ? &ts32 : NULL,
-                                NULL /* Unused.  */, FUTEX_BITSET_MATCH_ANY);
-}
 #endif /* ! __ASSUME_TIME64_SYSCALLS */
 
 static int
@@ -198,28 +177,3 @@ __futex_clocklock_wait64 (int *futex, int val, clockid_t clockid,
 
   return -err;
 }
-
-int
-__futex_clock_wait_bitset64 (int *futexp, int val, clockid_t clockid,
-                             const struct __timespec64 *abstime,
-                             int private)
-{
-  int ret;
-  if (! lll_futex_supported_clockid (clockid))
-    {
-      return -EINVAL;
-    }
-
-  const unsigned int clockbit =
-    (clockid == CLOCK_REALTIME) ? FUTEX_CLOCK_REALTIME : 0;
-  const int op = __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private);
-
-  ret = INTERNAL_SYSCALL_CALL (futex_time64, futexp, op, val,
-                               abstime, NULL /* Unused.  */,
-                               FUTEX_BITSET_MATCH_ANY);
-#ifndef __ASSUME_TIME64_SYSCALLS
-  if (ret == -ENOSYS)
-    ret = __futex_clock_wait_bitset32 (futexp, val, clockid, abstime, private);
-#endif
-  return ret;
-}
diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h
index cefab74301..dcc7958d59 100644
--- a/sysdeps/nptl/futex-internal.h
+++ b/sysdeps/nptl/futex-internal.h
@@ -440,9 +440,4 @@ __futex_clocklock64 (int *futex, clockid_t clockid,
   return err;
 }
 
-int
-__futex_clock_wait_bitset64 (int *futexp, int val, clockid_t clockid,
-                             const struct __timespec64 *abstime,
-                             int private) attribute_hidden;
-
 #endif  /* futex-internal.h */


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-23 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 21:07 [glibc/azanella/futex-refactor] linux: nptl: Remove _futex_clock_wait_bitset64 Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2020-11-23 20:48 Adhemerval Zanella

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).