rcu: Adjust for unconditional ->completed assignment
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 11 Jul 2012 12:23:18 +0000 (05:23 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Sun, 23 Sep 2012 14:41:55 +0000 (07:41 -0700)
Now that the rcu_node structures' ->completed fields are unconditionally
assigned at grace-period cleanup time, they should already have the
correct value for the new grace period at grace-period initialization
time.  This commit therefore inserts a WARN_ON_ONCE() to verify this
invariant.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
kernel/rcutree.c

index f0f3a18c0a2049458f98b10f1ebb3a7d04677b5a..a2eadd04fb29cd7dfd22f2c128fe15c925d7eb42 100644 (file)
@@ -1080,6 +1080,7 @@ static int rcu_gp_init(struct rcu_state *rsp)
                rcu_preempt_check_blocked_tasks(rnp);
                rnp->qsmask = rnp->qsmaskinit;
                rnp->gpnum = rsp->gpnum;
+               WARN_ON_ONCE(rnp->completed != rsp->completed);
                rnp->completed = rsp->completed;
                if (rnp == rdp->mynode)
                        rcu_start_gp_per_cpu(rsp, rnp, rdp);
@@ -2777,7 +2778,8 @@ static void __init rcu_init_one(struct rcu_state *rsp,
                        raw_spin_lock_init(&rnp->fqslock);
                        lockdep_set_class_and_name(&rnp->fqslock,
                                                   &rcu_fqs_class[i], fqs[i]);
-                       rnp->gpnum = 0;
+                       rnp->gpnum = rsp->gpnum;
+                       rnp->completed = rsp->completed;
                        rnp->qsmask = 0;
                        rnp->qsmaskinit = 0;
                        rnp->grplo = j * cpustride;