This is the mail archive of the
mailing list for the glibc project.
Re: PI mutex support for pthread_cond_* now in nptl
- From: Richard Henderson <rth at twiddle dot net>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: libc-ports at sourceware dot org, libc-alpha at sourceware dot org
- Date: Tue, 19 Feb 2013 08:41:57 -0800
- Subject: Re: PI mutex support for pthread_cond_* now in nptl
- References: <20130218105637.GJ32163@spoyarek.pnq.redhat.com>
On 2013-02-18 02:56, Siddhesh Poyarekar wrote:
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
- 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
- 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.