diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2012-11-05 21:12:10 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2012-11-05 21:12:52 +0530 |
commit | 8f861542dd0603bef99e126e509ece89514c1eeb (patch) | |
tree | 083f3bd20edfa09a2341e0340013c0781b4696ad /nptl/sysdeps/unix/sysv/linux/s390 | |
parent | 155ee340b875834693fbd1b7401af7fe88ace04d (diff) | |
download | glibc-8f861542dd0603bef99e126e509ece89514c1eeb.tar.gz glibc-8f861542dd0603bef99e126e509ece89514c1eeb.tar.xz glibc-8f861542dd0603bef99e126e509ece89514c1eeb.zip |
[S390,PPC] Implement FUTEX_WAIT_BITSET for timedwait functions
Since the FUTEX_WAIT operation takes a relative timeout, the pthread_cond_timedwait and other timed function implementations have to get a relative timeout from the absolute timeout parameter it gets before it makes the futex syscall. This value is then converted back into an absolute timeout within the kernel. This is a waste and has hence been improved upon by a FUTEX_WAIT_BITSET operation (OR'd with FUTEX_CLOCK_REALTIME to make the kernel use the realtime clock instead of the default monotonic clock). This was implemented only in the x86 and sh assembly code and not in the C code. This patch implements support for FUTEX_WAIT_BITSET whenever available (since linux-2.6.29) for s390 and powerpc.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/s390')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h index 97092823df..0b7110f11b 100644 --- a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h @@ -93,6 +93,26 @@ __result; \ }) +#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \ + ({ \ + register unsigned long int __r2 asm ("2") = (unsigned long int) (futexp); \ + register unsigned long int __r3 asm ("3") \ + = __lll_private_flag ((FUTEX_WAIT_BITSET | clockbit), private); \ + register unsigned long int __r4 asm ("4") = (long int) (val); \ + register unsigned long int __r5 asm ("5") = (long int) (timespec); \ + register unsigned long int __r6 asm ("6") = (unsigned long int) (NULL); \ + register unsigned long int __r7 asm ("7") \ + = (unsigned int) (FUTEX_BITSET_MATCH_ANY); \ + register unsigned long __result asm ("2"); \ + \ + __asm __volatile ("svc %b1" \ + : "=d" (__result) \ + : "i" (SYS_futex), "0" (__r2), "d" (__r3), \ + "d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \ + : "cc", "memory" ); \ + __result; \ + }) + #define lll_futex_wake(futex, nr, private) \ ({ \ |