rcu: Move rcu_cpu_started per-CPU variable to rcu_data
authorPaul E. McKenney <paulmck@kernel.org>
Sat, 25 Jul 2020 03:22:05 +0000 (20:22 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 25 Aug 2020 01:37:54 +0000 (18:37 -0700)
When the rcu_cpu_started per-CPU variable was added by commit
f64c6013a202 ("rcu/x86: Provide early rcu_cpu_starting() callback"),
there were multiple sets of per-CPU rcu_data structures.  Therefore, the
rcu_cpu_started flag was added as a separate per-CPU variable.  But now
there is only one set of per-CPU rcu_data structures, so this commit
moves rcu_cpu_started to a new ->cpu_started field in that structure.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tree.c
kernel/rcu/tree.h

index da05afc534931c83a300be83fc4e8d826583342c..52108dd921698a95b2070db40009ba37746be1a1 100644 (file)
@@ -3967,8 +3967,6 @@ int rcutree_offline_cpu(unsigned int cpu)
        return 0;
 }
 
-static DEFINE_PER_CPU(int, rcu_cpu_started);
-
 /*
  * Mark the specified CPU as being online so that subsequent grace periods
  * (both expedited and normal) will wait on it.  Note that this means that
@@ -3988,12 +3986,11 @@ void rcu_cpu_starting(unsigned int cpu)
        struct rcu_node *rnp;
        bool newcpu;
 
-       if (per_cpu(rcu_cpu_started, cpu))
+       rdp = per_cpu_ptr(&rcu_data, cpu);
+       if (rdp->cpu_started)
                return;
+       rdp->cpu_started = true;
 
-       per_cpu(rcu_cpu_started, cpu) = 1;
-
-       rdp = per_cpu_ptr(&rcu_data, cpu);
        rnp = rdp->mynode;
        mask = rdp->grpmask;
        raw_spin_lock_irqsave_rcu_node(rnp, flags);
@@ -4053,7 +4050,7 @@ void rcu_report_dead(unsigned int cpu)
        raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
        raw_spin_unlock(&rcu_state.ofl_lock);
 
-       per_cpu(rcu_cpu_started, cpu) = 0;
+       rdp->cpu_started = false;
 }
 
 /*
index c96ae351688b9cff62775c55043fec7c1590b01c..309bc7f41d350836ff3477c3615f840c4cb7968a 100644 (file)
@@ -156,6 +156,7 @@ struct rcu_data {
        bool            beenonline;     /* CPU online at least once. */
        bool            gpwrap;         /* Possible ->gp_seq wrap. */
        bool            exp_deferred_qs; /* This CPU awaiting a deferred QS? */
+       bool            cpu_started;    /* RCU watching this onlining CPU. */
        struct rcu_node *mynode;        /* This CPU's leaf of hierarchy */
        unsigned long grpmask;          /* Mask to apply to leaf qsmask. */
        unsigned long   ticks_this_gp;  /* The number of scheduling-clock */