From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754458AbdDOOLi (ORCPT ); Sat, 15 Apr 2017 10:11:38 -0400 Received: from terminus.zytor.com ([65.50.211.136]:47613 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753294AbdDOOLf (ORCPT ); Sat, 15 Apr 2017 10:11:35 -0400 Date: Sat, 15 Apr 2017 07:07:04 -0700 From: "tip-bot for Darren Hart (VMware)" Message-ID: Cc: hpa@zytor.com, dvhart@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, peterz@infradead.org Reply-To: mingo@kernel.org, dvhart@infradead.org, hpa@zytor.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, peterz@infradead.org In-Reply-To: <20170414223138.GA4222@fury> References: <20170414223138.GA4222@fury> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] futex: Clarify mark_wake_futex memory barrier usage Git-Commit-ID: 38fcd06e9b7f6855db1f3ebac5e18b8fdb467ffd X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 38fcd06e9b7f6855db1f3ebac5e18b8fdb467ffd Gitweb: http://git.kernel.org/tip/38fcd06e9b7f6855db1f3ebac5e18b8fdb467ffd Author: Darren Hart (VMware) AuthorDate: Fri, 14 Apr 2017 15:31:38 -0700 Committer: Thomas Gleixner CommitDate: Sat, 15 Apr 2017 16:03:46 +0200 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) Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170414223138.GA4222@fury Signed-off-by: Thomas Gleixner --- 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); }