futex: Add memory barrier commentary to futex_wait_queue_me()

The memory barrier semantics of futex_wait_queue_me() are
non-obvious. Add some commentary to try and clarify it.

Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Dinakar Guniguntala <dino@in.ibm.com>
Cc: John Stultz <johnstul@us.ibm.com>
LKML-Reference: <20090924185447.694.38948.stgit@Aeon>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Darren Hart and committed by
Ingo Molnar
9beba3c5 0729e196

+6
+6
kernel/futex.c
··· 1656 1656 static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, 1657 1657 struct hrtimer_sleeper *timeout) 1658 1658 { 1659 + /* 1660 + * The task state is guaranteed to be set before another task can 1661 + * wake it. set_current_state() is implemented using set_mb() and 1662 + * queue_me() calls spin_unlock() upon completion, both serializing 1663 + * access to the hash list and forcing another memory barrier. 1664 + */ 1659 1665 set_current_state(TASK_INTERRUPTIBLE); 1660 1666 queue_me(q, hb); 1661 1667