From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mathieu.desnoyers@polymtl.ca, mingo@elte.hu,
josht@linux.vnet.ibm.com, laijs@cn.fujitsu.com,
dipankar@in.ibm.com, akpm@linux-foundation.org,
dvhltc@us.ibm.com, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, rostedt@goodmis.org,
hugh.dickins@tiscali.co.uk, benh@kernel.crashing.org
Subject: [PATCH -tip/core/rcu] Fix rcu_migrate_callback() to allow for multiple waiters
Date: Wed, 19 Aug 2009 18:31:53 -0700 [thread overview]
Message-ID: <20090820013153.GA19944@linux.vnet.ibm.com> (raw)
The current interaction between rcu_barrier() and CPU hotplug can result
in multiple tasks waiting on rcu_migrate_wq: there can be one CPU-hotplug
notifier, and, because rcu_barrier() invokes wait_migrated_callbacks()
outside of rcu_barrier_mutex, an arbitrarily large number of tasks
executing in _rcu_barrier(). This situation could result in hangs,
because rcu_migrate_callback() would wake up but one task.
This patch addresses this problem by awakening all sleepers.
Located-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
rcupdate.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index bd5d5c8..6c59e1b 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -211,10 +211,17 @@ void rcu_barrier_sched(void)
}
EXPORT_SYMBOL_GPL(rcu_barrier_sched);
+/*
+ * Wake up anyone waiting on migration of RCU callbacks from a CPU
+ * going offline. There can be only one CPU-hotplug notifier waiting,
+ * but there can be any number of rcu_barrier() invocations waiting,
+ * due to the fact that rcu_barrier() does its wait outside of the
+ * rcu_barrier_mutex.
+ */
static void rcu_migrate_callback(struct rcu_head *notused)
{
if (atomic_dec_and_test(&rcu_migrate_type_count))
- wake_up(&rcu_migrate_wq);
+ wake_up_all(&rcu_migrate_wq);
}
extern int rcu_cpu_notify(struct notifier_block *self,
next reply other threads:[~2009-08-20 1:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-20 1:31 Paul E. McKenney [this message]
2009-08-20 3:30 ` [PATCH -tip/core/rcu] Fix rcu_migrate_callback() to allow for multiple waiters Lai Jiangshan
2009-08-20 3:45 ` Paul E. McKenney
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=20090820013153.GA19944@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=dipankar@in.ibm.com \
--cc=dvhltc@us.ibm.com \
--cc=hugh.dickins@tiscali.co.uk \
--cc=josht@linux.vnet.ibm.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@elte.hu \
--cc=niv@us.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).