aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/locking/rwsem-xadd.c
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@stgolabs.net>2015-01-30 04:14:24 -0500
committerIngo Molnar <mingo@kernel.org>2015-02-18 10:57:10 -0500
commit49e4b2bcf7b812e985e65b6c8a0255b1520a6e7e (patch)
tree72b8d5e9e0ce330251a310e05b5633fc8f505371 /kernel/locking/rwsem-xadd.c
parenta21294644623ee41034db60e93aaebed4db0e57b (diff)
locking/rwsem: Document barrier need when waking tasks
The need for the smp_mb() in __rwsem_do_wake() should be properly documented. Applies to both xadd and spinlock variants. Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Jason Low <jason.low2@hp.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Michel Lespinasse <walken@google.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Tim Chen <tim.c.chen@linux.intel.com> Link: http://lkml.kernel.org/r/1422609267-15102-3-git-send-email-dave@stgolabs.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/locking/rwsem-xadd.c')
-rw-r--r--kernel/locking/rwsem-xadd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c
index 2f7cc4076f50..82aba467564a 100644
--- a/kernel/locking/rwsem-xadd.c
+++ b/kernel/locking/rwsem-xadd.c
@@ -186,6 +186,13 @@ __rwsem_do_wake(struct rw_semaphore *sem, enum rwsem_wake_type wake_type)
186 waiter = list_entry(next, struct rwsem_waiter, list); 186 waiter = list_entry(next, struct rwsem_waiter, list);
187 next = waiter->list.next; 187 next = waiter->list.next;
188 tsk = waiter->task; 188 tsk = waiter->task;
189 /*
190 * Make sure we do not wakeup the next reader before
191 * setting the nil condition to grant the next reader;
192 * otherwise we could miss the wakeup on the other
193 * side and end up sleeping again. See the pairing
194 * in rwsem_down_read_failed().
195 */
189 smp_mb(); 196 smp_mb();
190 waiter->task = NULL; 197 waiter->task = NULL;
191 wake_up_process(tsk); 198 wake_up_process(tsk);