[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-89061d3d58e1f0742139605dc6a7950aa1ecc019@git.kernel.org>
Date: Fri, 16 Oct 2009 08:40:06 GMT
From: tip-bot for Darren Hart <dvhltc@...ibm.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, dvhltc@...ibm.com, hpa@...or.com,
mingo@...hat.com, jkacur@...hat.com, johnstul@...ux.vnet.ibm.com,
eric.dumazet@...il.com, peterz@...radead.org, dino@...ibm.com,
sdietrich@...ell.com, stable@...nel.org, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:core/urgent] futex: Move drop_futex_key_refs out of spinlock'ed region
Commit-ID: 89061d3d58e1f0742139605dc6a7950aa1ecc019
Gitweb: http://git.kernel.org/tip/89061d3d58e1f0742139605dc6a7950aa1ecc019
Author: Darren Hart <dvhltc@...ibm.com>
AuthorDate: Thu, 15 Oct 2009 15:30:48 -0700
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Fri, 16 Oct 2009 10:19:18 +0200
futex: 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 -
which may be non-atomic.
It is therefore safer to defer this drop operation until after the
futex_hash_bucket spinlock has been dropped.
Originally-From: Helge Bahmann <hcb@...oticmind.net>
Signed-off-by: Darren Hart <dvhltc@...ibm.com>
Cc: <stable@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Eric Dumazet <eric.dumazet@...il.com>
Cc: Dinakar Guniguntala <dino@...ibm.com>
Cc: John Stultz <johnstul@...ux.vnet.ibm.com>
Cc: Sven-Thorsten Dietrich <sdietrich@...ell.com>
Cc: John Kacur <jkacur@...hat.com>
LKML-Reference: <4AD7A298.5040802@...ibm.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/futex.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kernel/futex.c b/kernel/futex.c
index 06938e5..642f3bb 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1029,7 +1029,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;
@@ -1227,6 +1226,7 @@ retry_private:
*/
if (ret == 1) {
WARN_ON(pi_state);
+ drop_count++;
task_count++;
ret = get_futex_value_locked(&curval2, uaddr2);
if (!ret)
@@ -1305,6 +1305,7 @@ retry_private:
if (ret == 1) {
/* We got the lock. */
requeue_pi_wake_futex(this, &key2, hb2);
+ drop_count++;
continue;
} else if (ret) {
/* -EDEADLK */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists