diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2014-10-23 23:27:00 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-10-26 11:16:18 -0400 |
commit | 993b2ff221999066fcff231590593d0b98f45d32 (patch) | |
tree | 7cd1c4dcfed58b3785ca2849993e0e004e7d690c | |
parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) |
futex: Mention key referencing differences between shared and private futexes
Update our documentation as of fix 76835b0ebf8 (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: Davidlohr 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: Catalin Marinas <catalin.marinas@arm.com>
Link: http://lkml.kernel.org/r/1414121220.817.0.camel@linux-t7sj.site
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | kernel/futex.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index f3a3a071283c..bbf071f325b8 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -143,9 +143,8 @@ | |||
143 | * | 143 | * |
144 | * Where (A) orders the waiters increment and the futex value read through | 144 | * Where (A) orders the waiters increment and the futex value read through |
145 | * atomic operations (see hb_waiters_inc) and where (B) orders the write | 145 | * atomic operations (see hb_waiters_inc) and where (B) orders the write |
146 | * to futex and the waiters read -- this is done by the barriers in | 146 | * to futex and the waiters read -- this is done by the barriers for both |
147 | * get_futex_key_refs(), through either ihold or atomic_inc, depending on the | 147 | * shared and private futexes in get_futex_key_refs(). |
148 | * futex type. | ||
149 | * | 148 | * |
150 | * This yields the following case (where X:=waiters, Y:=futex): | 149 | * This yields the following case (where X:=waiters, Y:=futex): |
151 | * | 150 | * |
@@ -344,13 +343,20 @@ static void get_futex_key_refs(union futex_key *key) | |||
344 | futex_get_mm(key); /* implies MB (B) */ | 343 | futex_get_mm(key); /* implies MB (B) */ |
345 | break; | 344 | break; |
346 | default: | 345 | default: |
346 | /* | ||
347 | * Private futexes do not hold reference on an inode or | ||
348 | * mm, therefore the only purpose of calling get_futex_key_refs | ||
349 | * is because we need the barrier for the lockless waiter check. | ||
350 | */ | ||
347 | smp_mb(); /* explicit MB (B) */ | 351 | smp_mb(); /* explicit MB (B) */ |
348 | } | 352 | } |
349 | } | 353 | } |
350 | 354 | ||
351 | /* | 355 | /* |
352 | * Drop a reference to the resource addressed by a key. | 356 | * Drop a reference to the resource addressed by a key. |
353 | * The hash bucket spinlock must not be held. | 357 | * The hash bucket spinlock must not be held. This is |
358 | * a no-op for private futexes, see comment in the get | ||
359 | * counterpart. | ||
354 | */ | 360 | */ |
355 | static void drop_futex_key_refs(union futex_key *key) | 361 | static void drop_futex_key_refs(union futex_key *key) |
356 | { | 362 | { |