diff options
author | Darren Hart (VMware) <dvhart@infradead.org> | 2017-04-14 18:31:38 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-04-15 10:03:46 -0400 |
commit | 38fcd06e9b7f6855db1f3ebac5e18b8fdb467ffd (patch) | |
tree | a5b9dd2ff5d7ba22e0953270de1b63290e29df03 /kernel/futex.c | |
parent | 94ffac5d847cfd790bb37b7cef1cad803743985e (diff) |
futex: Clarify mark_wake_futex memory barrier usage
Clarify the scenario described in mark_wake_futex requiring the
smp_store_release(). Update the comment to explicitly refer to the
plist_del now under __unqueue_futex() (previously plist_del was in the
same function as the comment).
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20170414223138.GA4222@fury
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r-- | kernel/futex.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index ede2f1ef8511..357348a6cf6b 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -1380,10 +1380,11 @@ static void mark_wake_futex(struct wake_q_head *wake_q, struct futex_q *q) | |||
1380 | wake_q_add(wake_q, p); | 1380 | wake_q_add(wake_q, p); |
1381 | __unqueue_futex(q); | 1381 | __unqueue_futex(q); |
1382 | /* | 1382 | /* |
1383 | * The waiting task can free the futex_q as soon as | 1383 | * The waiting task can free the futex_q as soon as q->lock_ptr = NULL |
1384 | * q->lock_ptr = NULL is written, without taking any locks. A | 1384 | * is written, without taking any locks. This is possible in the event |
1385 | * memory barrier is required here to prevent the following | 1385 | * of a spurious wakeup, for example. A memory barrier is required here |
1386 | * store to lock_ptr from getting ahead of the plist_del. | 1386 | * to prevent the following store to lock_ptr from getting ahead of the |
1387 | * plist_del in __unqueue_futex(). | ||
1387 | */ | 1388 | */ |
1388 | smp_store_release(&q->lock_ptr, NULL); | 1389 | smp_store_release(&q->lock_ptr, NULL); |
1389 | } | 1390 | } |