public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Darren Hart <dvhltc@us.ibm.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, dvhltc@us.ibm.com, hpa@zytor.com,
	mingo@redhat.com, eric.dumazet@gmail.com, johnstul@us.ibm.com,
	peterz@infradead.org, dino@in.ibm.com, tglx@linutronix.de,
	mingo@elte.hu
Subject: [tip:core/urgent] futex: Add memory barrier commentary to futex_wait_queue_me()
Date: Fri, 25 Sep 2009 06:20:19 GMT	[thread overview]
Message-ID: <tip-9beba3c54dd180a26a1da2027cfbe9edfaf9c40e@git.kernel.org> (raw)
In-Reply-To: <20090924185447.694.38948.stgit@Aeon>

Commit-ID:  9beba3c54dd180a26a1da2027cfbe9edfaf9c40e
Gitweb:     http://git.kernel.org/tip/9beba3c54dd180a26a1da2027cfbe9edfaf9c40e
Author:     Darren Hart <dvhltc@us.ibm.com>
AuthorDate: Thu, 24 Sep 2009 11:54:47 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 24 Sep 2009 22:30:10 +0200

futex: Add memory barrier commentary to futex_wait_queue_me()

The memory barrier semantics of futex_wait_queue_me() are
non-obvious. Add some commentary to try and clarify it.

Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Dinakar Guniguntala <dino@in.ibm.com>
Cc: John Stultz <johnstul@us.ibm.com>
LKML-Reference: <20090924185447.694.38948.stgit@Aeon>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/futex.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 463af2e..b911adc 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1656,6 +1656,12 @@ out:
 static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q,
 				struct hrtimer_sleeper *timeout)
 {
+	/*
+	 * The task state is guaranteed to be set before another task can
+	 * wake it. set_current_state() is implemented using set_mb() and
+	 * queue_me() calls spin_unlock() upon completion, both serializing
+	 * access to the hash list and forcing another memory barrier.
+	 */
 	set_current_state(TASK_INTERRUPTIBLE);
 	queue_me(q, hb);
 

      reply	other threads:[~2009-09-25  6:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24 18:54 [PATCH] futex: add memory barrier commentary to futex_wait_queue_me Darren Hart
2009-09-25  6:20 ` tip-bot for Darren Hart [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-9beba3c54dd180a26a1da2027cfbe9edfaf9c40e@git.kernel.org \
    --to=dvhltc@us.ibm.com \
    --cc=dino@in.ibm.com \
    --cc=eric.dumazet@gmail.com \
    --cc=hpa@zytor.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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