[PATCH siddhesh/wait_bitset] Use FUTEX_WAIT_BITSET for pthread_cond_timedwait for non-x86: ppc, s390
Siddhesh Poyarekar
siddhesh@redhat.com
Mon Oct 22 12:54:00 GMT 2012
Hi,
Since the FUTEX_WAIT operation takes a relative timeout, the
pthread_cond_timedwait implementation has 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.
I have access to an ia64 system as well, so I'll add ia64 once this
patch is in. Other arch maintainers will need to add a definition for a
lll_futex_timed_wait_bitset macro similar to what I have implemented in
this patch to use this feature. If this macro is not available, the old
behaviour is compiled in.
I have verified that there are no regressions resulting from this patch
on s390 as well as on powerpc. OK to commit?
Regards,
Siddhesh
nptl/ChangeLog:
* pthread_cond_timedwait.c (__pthread_cond_timedwait): Timeout
if absolute timeout is negative.
[__ASSUME_FUTEX_CLOCK_REALTIME &&
lll_futex_timed_wait_bitset]: Use lll_futex_timed_wait_bitset.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
(lll_futex_timed_wait_bitset); Define.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h
(lll_futex_timed_wait_bitset); Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: futex-wait-bitset.patch
Type: text/x-patch
Size: 5105 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20121022/95903581/attachment.bin>
More information about the Libc-alpha
mailing list