From: tip-bot for Davidlohr Bueso <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: dbueso@suse.de, peterz@infradead.org, hpa@zytor.com,
Matteo.Franchin@arm.com, linux-kernel@vger.kernel.org,
dave@stgolabs.net, catalin.marinas@arm.com,
torvalds@linux-foundation.org, dvhart@linux.intel.com,
paulmck@linux.vnet.ibm.com, davidlohr@hp.com, mingo@kernel.org,
tglx@linutronix.de
Subject: [tip:locking/urgent] futex: Mention key referencing differences between shared and private futexes
Date: Sun, 26 Oct 2014 08:22:28 -0700 [thread overview]
Message-ID: <tip-993b2ff221999066fcff231590593d0b98f45d32@git.kernel.org> (raw)
In-Reply-To: <1414121220.817.0.camel@linux-t7sj.site>
Commit-ID: 993b2ff221999066fcff231590593d0b98f45d32
Gitweb: http://git.kernel.org/tip/993b2ff221999066fcff231590593d0b98f45d32
Author: Davidlohr Bueso <dave@stgolabs.net>
AuthorDate: Thu, 23 Oct 2014 20:27:00 -0700
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 26 Oct 2014 16:16:18 +0100
futex: Mention key referencing differences between shared and private futexes
Update our documentation as of fix 76835b0ebf8 (futex: Ensure
get_futex_key_refs() always implies a barrier). Explicitly
state that we don't do key referencing for private futexes.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Matteo Franchin <Matteo.Franchin@arm.com>
Cc: Davidlohr Bueso <davidlohr@hp.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Darren Hart <dvhart@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Link: http://lkml.kernel.org/r/1414121220.817.0.camel@linux-t7sj.site
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/futex.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/kernel/futex.c b/kernel/futex.c
index f3a3a07..bbf071f 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -143,9 +143,8 @@
*
* Where (A) orders the waiters increment and the futex value read through
* atomic operations (see hb_waiters_inc) and where (B) orders the write
- * to futex and the waiters read -- this is done by the barriers in
- * get_futex_key_refs(), through either ihold or atomic_inc, depending on the
- * futex type.
+ * to futex and the waiters read -- this is done by the barriers for both
+ * shared and private futexes in get_futex_key_refs().
*
* This yields the following case (where X:=waiters, Y:=futex):
*
@@ -344,13 +343,20 @@ static void get_futex_key_refs(union futex_key *key)
futex_get_mm(key); /* implies MB (B) */
break;
default:
+ /*
+ * Private futexes do not hold reference on an inode or
+ * mm, therefore the only purpose of calling get_futex_key_refs
+ * is because we need the barrier for the lockless waiter check.
+ */
smp_mb(); /* explicit MB (B) */
}
}
/*
* Drop a reference to the resource addressed by a key.
- * The hash bucket spinlock must not be held.
+ * The hash bucket spinlock must not be held. This is
+ * a no-op for private futexes, see comment in the get
+ * counterpart.
*/
static void drop_futex_key_refs(union futex_key *key)
{
prev parent reply other threads:[~2014-10-26 15:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-17 16:38 [PATCH] futex: Ensure get_futex_key_refs() always implies a barrier Catalin Marinas
2014-10-18 6:54 ` Mike Galbraith
2014-10-18 7:09 ` Mike Galbraith
2014-10-18 15:28 ` Linus Torvalds
2014-10-18 16:15 ` Mike Galbraith
2014-10-18 7:33 ` Davidlohr Bueso
2014-10-18 19:58 ` Davidlohr Bueso
2014-10-18 20:50 ` Linus Torvalds
2014-10-19 2:16 ` Davidlohr Bueso
2014-10-20 9:11 ` Thomas Gleixner
2014-10-20 10:49 ` Catalin Marinas
2014-10-20 15:32 ` Linus Torvalds
2014-10-20 16:00 ` Catalin Marinas
2014-10-18 19:32 ` Darren Hart
2014-10-18 20:19 ` Davidlohr Bueso
2014-10-18 20:25 ` Darren Hart
2014-10-20 10:15 ` Catalin Marinas
2014-10-24 3:27 ` [PATCH] futex: Mention key referencing differences between shared and private futexes Davidlohr Bueso
2014-10-24 9:11 ` Catalin Marinas
2014-10-26 15:22 ` tip-bot for Davidlohr Bueso [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-993b2ff221999066fcff231590593d0b98f45d32@git.kernel.org \
--to=tipbot@zytor.com \
--cc=Matteo.Franchin@arm.com \
--cc=catalin.marinas@arm.com \
--cc=dave@stgolabs.net \
--cc=davidlohr@hp.com \
--cc=dbueso@suse.de \
--cc=dvhart@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).