From: Darren Hart <dvhltc@us.ibm.com>
To: "lkml, " <linux-kernel@vger.kernel.org>,
stable@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>,
Eric Dumazet <eric.dumazet@gmail.com>,
Dinakar Guniguntala <dino@in.ibm.com>,
John Stultz <johnstul@linux.vnet.ibm.com>,
Sven-Thorsten Dietrich <sdietrich@novell.com>,
John Kacur <jkacur@redhat.com>
Subject: [PATCH] futex: Move drop_futex_key_refs out of spinlock'ed region
Date: Thu, 15 Oct 2009 15:30:48 -0700 [thread overview]
Message-ID: <4AD7A298.5040802@us.ibm.com> (raw)
>From edd4dea2dfb706d34a42255f424781f9daa79f01 Mon Sep 17 00:00:00 2001
From: Helge Bahmann <hcb@chaoticmind.net>
Date: Mon, 12 Oct 2009 11:31:35 +0200
Subject: [PATCH] Move drop_futex_key_refs out of spinlock'ed region
When requeuing tasks from one futex to another, the reference held
by the requeued task to the original futex location needs to
be dropped eventually. Dropping the reference may ultimately lead
to a call to "iput_final" and subsequently call into filesystem-
specific code. It is therefore safer to defer this drop operation
until after the futex_hash_bucket spinlock has been dropped.
Authored-by: Helge Bahmann <hcb@chaoticmind.net>
Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
CC: stable@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Dinakar Guniguntala <dino@in.ibm.com>
CC: John Stultz <johnstul@us.ibm.com>
CC: Sven-Thorsten Dietrich <sdietrich@novell.com>
CC: John Kacur <jkacur@redhat.com>
---
kernel/futex.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kernel/futex.c b/kernel/futex.c
index 4949d33..f49bf07 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1028,7 +1028,6 @@ static inline
void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key,
struct futex_hash_bucket *hb)
{
- drop_futex_key_refs(&q->key);
get_futex_key_refs(key);
q->key = *key;
@@ -1226,6 +1225,7 @@ retry_private:
*/
if (ret == 1) {
WARN_ON(pi_state);
+ drop_count++;
task_count++;
ret = get_futex_value_locked(&curval2, uaddr2);
if (!ret)
@@ -1304,6 +1304,7 @@ retry_private:
if (ret == 1) {
/* We got the lock. */
requeue_pi_wake_futex(this, &key2, hb2);
+ drop_count++;
continue;
} else if (ret) {
/* -EDEADLK */
--
1.5.6.5
--
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
next reply other threads:[~2009-10-15 22:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 22:30 Darren Hart [this message]
2009-10-16 8:40 ` [tip:core/urgent] futex: Move drop_futex_key_refs out of spinlock'ed region tip-bot for Darren Hart
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=4AD7A298.5040802@us.ibm.com \
--to=dvhltc@us.ibm.com \
--cc=dino@in.ibm.com \
--cc=eric.dumazet@gmail.com \
--cc=jkacur@redhat.com \
--cc=johnstul@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=sdietrich@novell.com \
--cc=stable@kernel.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