Skip to content

Commit

Permalink
futex: comment requeue key reference semantics
Browse files Browse the repository at this point in the history
We've tripped over the futex_requeue drop_count refering to key2
instead of key1.  The code is actually correct, but is non-intuitive.
This patch adds an explicit comment explaining the requeue.

Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Darren Hart authored and Ingo Molnar committed Apr 2, 2009
1 parent 833bb30 commit cd84a42
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kernel/futex.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,12 @@ static int futex_requeue(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,
out_unlock:
double_unlock_hb(hb1, hb2);

/* drop_futex_key_refs() must be called outside the spinlocks. */
/*
* drop_futex_key_refs() must be called outside the spinlocks. During
* the requeue we moved futex_q's from the hash bucket at key1 to the
* one at key2 and updated their key pointer. We no longer need to
* hold the references to key1.
*/
while (--drop_count >= 0)
drop_futex_key_refs(&key1);

Expand Down

0 comments on commit cd84a42

Please sign in to comment.