From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] rcu: force all adopted callbacks are invoked before next cpu-offline
Date: Fri, 22 Oct 2010 16:23:01 +0800 [thread overview]
Message-ID: <4CC149E5.60901@cn.fujitsu.com> (raw)
When cpu-offline/online happen continuously, a CPU may
adopts too much callbacks or some callbacks are just
moved back and forth without invoked.
It will cause a CPU has a lot of burden or some callbacks
are invoked very late or starvation.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 669d7fe..8af45d6 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1811,6 +1811,23 @@ static int __cpuinit rcu_cpu_notify(struct notifier_block *self,
case CPU_UP_CANCELED_FROZEN:
rcu_offline_cpu(cpu);
break;
+ case CPU_POST_DEAD:
+ case CPU_POST_DEAD | CPU_TASKS_FROZEN:
+ /*
+ * When a cpu is offline, the callbacks in the offline CPU
+ * are orphaned and adopted by a online CPU. These callbacks
+ * are processed as new inserted one. So in the worst case,
+ * if the offline/online happen continuously, a CPU may
+ * adopts too much callbacks or some callbacks are just
+ * moved back and forth without invoked.
+ *
+ * To fix it, we must force all adopted callbacks are invoked
+ * before next cpu-offline.
+ */
+ rcu_barrier_bh();
+ rcu_barrier_sched();
+ rcu_barrier();
+ break;
default:
break;
}
reply other threads:[~2010-10-22 8:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4CC149E5.60901@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
/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