Skip to content

Commit

Permalink
futex: Add memory barrier commentary to futex_wait_queue_me()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Darren Hart authored and Ingo Molnar committed Sep 24, 2009
1 parent 0729e19 commit 9beba3c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kernel/futex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,12 @@ static int fixup_owner(u32 __user *uaddr, int fshared, struct futex_q *q,
static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q,
struct hrtimer_sleeper *timeout)
{
/*
* The task state is guaranteed to be set before another task can
* wake it. set_current_state() is implemented using set_mb() and
* queue_me() calls spin_unlock() upon completion, both serializing
* access to the hash list and forcing another memory barrier.
*/
set_current_state(TASK_INTERRUPTIBLE);
queue_me(q, hb);

Expand Down

0 comments on commit 9beba3c

Please sign in to comment.