Re: [PATCH 2.6.21-rc3-mm2 3/4] futex_requeue_pi optimization

From: Peter Zijlstra
Date: Fri Mar 16 2007 - 06:14:26 EST


On Tue, 2007-03-13 at 10:52 +0100, Pierre.Peiffer@xxxxxxxx wrote:
> plain text document attachment (futex-requeue-pi.diff)
> This patch provides the futex_requeue_pi functionality.
>
> This provides an optimization, already used for (normal) futexes, to be used for
> PI-futexes.
>
> This optimization is currently used by the glibc in pthread_broadcast, when
> using "normal" mutexes. With futex_requeue_pi, it can be used with PRIO_INHERIT
> mutexes too.
>
> Signed-off-by: Pierre Peiffer <pierre.peiffer@xxxxxxxx>
>
> ---

> /*
> + * Retrieve the original address used to compute this key
> + */
> +static void *get_futex_address(union futex_key *key)
> +{
> + void *uaddr;
> +
> + if (key->both.offset & 1) {
> + /* shared mapping */
> + uaddr = (void*)((key->shared.pgoff << PAGE_SHIFT)
> + + key->shared.offset - 1);
> + } else {
> + /* private mapping */
> + uaddr = (void*)(key->private.address + key->private.offset);
> + }
> +
> + return uaddr;
> +}

This will not work for nonlinear vmas, granted, not a lot of ppl stick
futexes in nonlinear vmas, but the futex_key stuff handles it, this
doesn't.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/