diff mbox

[tip/core/rcu,38/55] rcu: Prohibit grace periods during early boot

Message ID 1315332049-2604-38-git-send-email-paulmck@linux.vnet.ibm.com
State Accepted
Commit 037067a1b6f9a70f862f3ed9d59fe28b7cd55ac4
Headers show

Commit Message

Paul E. McKenney Sept. 6, 2011, 6 p.m. UTC
From: Paul E. McKenney <paul.mckenney@linaro.org>

Greater use of RCU during early boot (before the scheduler is operating)
is causing RCU to attempt to start grace periods during that time, which
in turn is resulting in both RCU and the callback functions attempting
to use the scheduler before it is ready.

This commit prevents these problems by prohibiting RCU grace periods
until after the scheduler has spawned the first non-idle task.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Comments

Josh Triplett Oct. 17, 2011, 1:51 a.m. UTC | #1
On Tue, Sep 06, 2011 at 11:00:32AM -0700, Paul E. McKenney wrote:
> From: Paul E. McKenney <paul.mckenney@linaro.org>
> 
> Greater use of RCU during early boot (before the scheduler is operating)
> is causing RCU to attempt to start grace periods during that time, which
> in turn is resulting in both RCU and the callback functions attempting
> to use the scheduler before it is ready.
> 
> This commit prevents these problems by prohibiting RCU grace periods
> until after the scheduler has spawned the first non-idle task.

As with patch 36, this seems like a good candidate for jump labels.

- Josh Triplett
diff mbox

Patch

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 0051dbf..9970116 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -838,8 +838,11 @@  rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
 	struct rcu_data *rdp = this_cpu_ptr(rsp->rda);
 	struct rcu_node *rnp = rcu_get_root(rsp);
 
-	if (!cpu_needs_another_gp(rsp, rdp) || rsp->fqs_active) {
-		if (cpu_needs_another_gp(rsp, rdp))
+	if (!rcu_scheduler_fully_active ||
+	    !cpu_needs_another_gp(rsp, rdp) ||
+	    rsp->fqs_active) {
+		if (rcu_scheduler_fully_active &&
+		    cpu_needs_another_gp(rsp, rdp))
 			rsp->fqs_need_gp = 1;
 		if (rnp->completed == rsp->completed) {
 			raw_spin_unlock_irqrestore(&rnp->lock, flags);