PI mutex support for pthread_cond_* now in nptl

Richard Henderson rth@twiddle.net
Tue Feb 19 16:42:00 GMT 2013


On 2013-02-18 02:56, Siddhesh Poyarekar wrote:
> 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.

Any chance we can move these macros into a generic linux header?
Given that we're using INTERNAL_SYSCALL macros, the definitions ought to 
be the same for all targets.


r~



More information about the Libc-alpha mailing list