This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
[ports] Use FUTEX_WAIT_BITSET for timed futex operations
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: libc-ports at sourceware dot org
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 5 Nov 2012 22:20:21 +0530
- Subject: [ports] Use FUTEX_WAIT_BITSET for timed futex operations
Hi,
The x86 implementations of these functions have long used
FUTEX_WAIT_BITSET instead of FUTEX_WAIT to wait in the futex system
call for timed operations like pthread_cond_timedwait,
pthread_rwlock_timed*lock and friends. FUTEX_WAIT_BITSET does not need
the additional computation of relative timeout in the function, which
gets converted back into an absolute timeout in the kernel. As a
result, FUTEX_WAIT_BITSET is faster than FUTEX_WAIT.
I just committed a change to s390 and ppc to make use of
FUTEX_WAIT_BITSET if it is available (linux 2.6.29 onwards):
http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=8f861542dd0603bef99e126e509ece89514c1eeb
I did not make this change for other architectures since I did not have
access to a test machine to verify the change. So I request the arch
maintainers to implement the macro lll_futex_timed_wait_bitset in the
manner similar to that in the patch above so that the rest of the code
can then take advantage of the performance improvement due to
FUTEX_WAIT_BITSET for their architecture. Currently, if
lll_futex_timed_wait_bitset is not defined, the code simply selects
lll_futex_timed_wait instead, which is the old behaviour.
Thanks,
Siddhesh