public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] futex: Clarify mark_wake_futex memory barrier usage
@ 2017-04-14 22:31 Darren Hart (VMware)
  2017-04-15 14:07 ` [tip:locking/core] " tip-bot for Darren Hart (VMware)
  0 siblings, 1 reply; 2+ messages in thread
From: Darren Hart (VMware) @ 2017-04-14 22:31 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Ingo Molnar, Peter Zijlstra

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: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 kernel/futex.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index ede2f1e..357348a 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)
 	wake_q_add(wake_q, p);
 	__unqueue_futex(q);
 	/*
-	 * The waiting task can free the futex_q as soon as
-	 * q->lock_ptr = NULL is written, without taking any locks. A
-	 * memory barrier is required here to prevent the following
-	 * store to lock_ptr from getting ahead of the plist_del.
+	 * The waiting task can free the futex_q as soon as q->lock_ptr = NULL
+	 * is written, without taking any locks. This is possible in the event
+	 * of a spurious wakeup, for example. A memory barrier is required here
+	 * to prevent the following store to lock_ptr from getting ahead of the
+	 * plist_del in __unqueue_futex().
 	 */
 	smp_store_release(&q->lock_ptr, NULL);
 }
-- 
2.9.3


-- 
Darren Hart
VMware Open Source Technology Center

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-15 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-14 22:31 [PATCH] futex: Clarify mark_wake_futex memory barrier usage Darren Hart (VMware)
2017-04-15 14:07 ` [tip:locking/core] " tip-bot for Darren Hart (VMware)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox