[PATCH 4.9 37/53] futex: Use smp_store_release() in mark_wake_futex()

From
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date
2021-03-29 08:05:08
Also in
lkml
Reply to
Greg Kroah-Hartman, 2021-03-29
From: Peter Zijlstra <peterz@infradead.org>

commit 1b367ece0d7e696cab1c8501bab282cc6a538b3f upstream.

Since the futex_q can dissapear the instruction after assigning NULL,
this really should be a RELEASE barrier. That stops loads from hitting
dead memory too.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <redacted>
Cc: bigeasy@linutronix.de
Cc: <redacted>
Cc: rostedt@goodmis.org
Cc: mathieu.desnoyers@efficios.com
Cc: <redacted>
Cc: dvhart@infradead.org
Cc: <redacted>
Link: http://lkml.kernel.org/r/20170322104151.604296452@infradead.org (local)
Signed-off-by: Thomas Gleixner <redacted>
Signed-off-by: Ben Hutchings <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/futex.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1565,8 +1565,7 @@ static void mark_wake_futex(struct wake_
 	 * memory barrier is required here to prevent the following
 	 * store to lock_ptr from getting ahead of the plist_del.
 	 */
-	smp_wmb();
-	q->lock_ptr = NULL;
+	smp_store_release(&q->lock_ptr, NULL);
 }
 
 /*

Thread (59 messages) 59 messages, 6 authors, last reply 2021-03-30
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help