Re: Update futex_q to clarify single waiter symmantics

From: Ingo Molnar
Date: Thu Dec 18 2008 - 05:44:28 EST



* Darren Hart <dvhltc@xxxxxxxxxx> wrote:

> From: Darren Hart <dvhltc@xxxxxxxxxx>
>
> I've tripped over this a couple times. The futex_q uses a waiters list
> to represent a single blocked task and then calles wake_up_all(). This
> can lead to confusion in trying to understand the intent of the code,
> which is to have a single futex_q for every task waiting on a futex.
> This patch corrects the problem, using a single pointer to the waiting
> task, and an appropriate call to wake_up, rather than wake_up_all.
>
> Compile and boot tested on an 8way x86_64 machine.
>
> Signed-off-by: Darren Hart <dvhltc@xxxxxxxxxx>
> ---
>
> kernel/futex.c | 11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)

applied to tip/core/futexes, thanks Darren!

> - wake_up_all(&q->waiters);
> + wake_up(&q->waiter);

yeah, the naming and the wake_up_all is a relic from the FUTEX_FD days -
but we removed that earlier this year:

| commit 82af7aca56c67061420d618cc5a30f0fd4106b80
| Author: Eric Sesterhenn <snakebyte@xxxxxx>
| Date: Fri Jan 25 10:40:46 2008 +0100
|
| Removal of FUTEX_FD

Ingo
--
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/