Hi arch-maintainers!
The x86 assembly code for pthread_cond_* functions has, since some
time now, been capable of utilizing PI mutexes (using
PTHREAD_PRIO_INHERIT when initializing a mutex) optimally by using the
FUTEX_WAIT_REQUEUE_PI and its companion FUTEX_CMP_REQUEUE_PI to
requeue waiters woken on pthread_cond_broadcast to the PI mutex while
waking just one child, hence avoiding the thundering herd effect.
This code is now available on the default C implementation in master,
which is used by most non-x86 architectures in glibc.
To allow your architecture to use this, you need to define the
following:
- lll_futex_wait_requeue_pi macro to call the FUTEX_WAIT_REQUEUE_PI
operation in a futex syscall.
- lll_futex_timed_wait_requeue_pi, which is the timed equivalent of
the above.
- lll_futex_cmp_requeue_pi to call FUTEX_CMP_REQUEUE_PI.
I have committed implementations for s390 and powerpc, which can be
used as examples for implementation on other architectures.