futex: Use smp_store_release() in mark_wake_futex()
authorPeter Zijlstra <peterz@infradead.org>
Wed, 22 Mar 2017 10:35:49 +0000 (11:35 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 23 Mar 2017 18:10:06 +0000 (19:10 +0100)
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: juri.lelli@arm.com
Cc: bigeasy@linutronix.de
Cc: xlpang@redhat.com
Cc: rostedt@goodmis.org
Cc: mathieu.desnoyers@efficios.com
Cc: jdesfossez@efficios.com
Cc: dvhart@infradead.org
Cc: bristot@redhat.com
Link: http://lkml.kernel.org/r/20170322104151.604296452@infradead.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/futex.c

index 1531cc405270a5f4ac026769b3085510c74f1388..cc103403828515aab860be3115fd9f57a4e29850 100644 (file)
@@ -1290,8 +1290,7 @@ static void mark_wake_futex(struct wake_q_head *wake_q, struct futex_q *q)
         * 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);
 }
 
 static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *top_waiter,