From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] rcu_barrier VS cpu_hotplug: Ensure callbacks in dead cpu are migrated to online cpu
Date: Sat, 07 Mar 2009 18:54:38 +0800 [thread overview]
Message-ID: <49B2526E.40106@cn.fujitsu.com> (raw)
[RFC]
I don't like this patch, but I thought for some days and I can't
thought out a better one.
I'm very hope rcu_barrier() can be called anywhere(any sleepable context).
But get_online_cpus() is a very large lock, it limits rcu_barrier().
We can avoid get_online_cpus() easily for rcupreempt by using a new rcu_barrier:
void rcu_barrier(void)
{
for each rcu_data {
lock rcu_data;
if rcu_data is not empty, queue a callback for rcu_barrier;
unlock rcu_data;
}
}
But we cannot use this algorithm for rcuclassic and rcutree,
rcu_data in rcuclassic and rcutree have not a spinlock for queuing callback.
From: Lai Jiangshan <laijs@cn.fujitsu.com>
cpu hotplug may be happened asynchronously, some rcu callbacks are maybe
still in dead cpu, rcu_barrier() also needs to wait for these rcu callbacks
to complete, so we must ensure callbacks in dead cpu are migrated to
online cpu.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index cae8a05..4665d18 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -129,6 +129,8 @@ static void rcu_barrier_func(void *type)
static void _rcu_barrier(enum rcu_barrier type)
{
BUG_ON(in_interrupt());
+ /* Ensure callbacks in dead cpu are migrated to online cpu */
+ get_online_cpus();
/* Take cpucontrol mutex to protect against CPU hotplug */
mutex_lock(&rcu_barrier_mutex);
init_completion(&rcu_barrier_completion);
@@ -147,6 +149,7 @@ static void _rcu_barrier(enum rcu_barrier type)
complete(&rcu_barrier_completion);
wait_for_completion(&rcu_barrier_completion);
mutex_unlock(&rcu_barrier_mutex);
+ put_online_cpus();
}
/**
next reply other threads:[~2009-03-07 10:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-07 10:54 Lai Jiangshan [this message]
2009-03-07 17:29 ` [PATCH] rcu_barrier VS cpu_hotplug: Ensure callbacks in dead cpu are migrated to online cpu Paul E. McKenney
2009-03-08 2:58 ` Lai Jiangshan
2009-03-08 6:20 ` Paul E. McKenney
2009-03-09 2:56 ` Lai Jiangshan
2009-03-09 4:28 ` Paul E. McKenney
2009-03-08 16:00 ` Ingo Molnar
2009-03-19 3:06 ` Lai Jiangshan
2009-03-19 4:05 ` Paul E. McKenney
[not found] ` <20090319082237.GA32179@elte.hu>
2009-03-20 9:40 ` Lai Jiangshan
2009-03-20 20:00 ` [tip:core/rcu] rcu: " Lai Jiangshan
2009-03-30 22:12 ` Lai Jiangshan
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=49B2526E.40106@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.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