Commit 993b2ff2 authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Thomas Gleixner

futex: Mention key referencing differences between shared and private futexes

Update our documentation as of fix 76835b0e (futex: Ensure
get_futex_key_refs() always implies a barrier). Explicitly
state that we don't do key referencing for private futexes.
Signed-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
Cc: Matteo Franchin <Matteo.Franchin@arm.com>
Cc: Davidlohr Bueso <davidlohr@hp.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Darren Hart <dvhart@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Link: http://lkml.kernel.org/r/1414121220.817.0.camel@linux-t7sj.siteSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent f114040e
...@@ -143,9 +143,8 @@ ...@@ -143,9 +143,8 @@
* *
* Where (A) orders the waiters increment and the futex value read through * Where (A) orders the waiters increment and the futex value read through
* atomic operations (see hb_waiters_inc) and where (B) orders the write * atomic operations (see hb_waiters_inc) and where (B) orders the write
* to futex and the waiters read -- this is done by the barriers in * to futex and the waiters read -- this is done by the barriers for both
* get_futex_key_refs(), through either ihold or atomic_inc, depending on the * shared and private futexes in get_futex_key_refs().
* futex type.
* *
* This yields the following case (where X:=waiters, Y:=futex): * This yields the following case (where X:=waiters, Y:=futex):
* *
...@@ -344,13 +343,20 @@ static void get_futex_key_refs(union futex_key *key) ...@@ -344,13 +343,20 @@ static void get_futex_key_refs(union futex_key *key)
futex_get_mm(key); /* implies MB (B) */ futex_get_mm(key); /* implies MB (B) */
break; break;
default: default:
/*
* Private futexes do not hold reference on an inode or
* mm, therefore the only purpose of calling get_futex_key_refs
* is because we need the barrier for the lockless waiter check.
*/
smp_mb(); /* explicit MB (B) */ smp_mb(); /* explicit MB (B) */
} }
} }
/* /*
* Drop a reference to the resource addressed by a key. * Drop a reference to the resource addressed by a key.
* The hash bucket spinlock must not be held. * The hash bucket spinlock must not be held. This is
* a no-op for private futexes, see comment in the get
* counterpart.
*/ */
static void drop_futex_key_refs(union futex_key *key) static void drop_futex_key_refs(union futex_key *key)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment