rcu: Move _rcu_barrier()'s rcu_head structures to rcu_data structures
authorPaul E. McKenney <paul.mckenney@linaro.org>
Tue, 29 May 2012 06:57:46 +0000 (23:57 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 2 Jul 2012 19:33:21 +0000 (12:33 -0700)
In order for multiple flavors of RCU to each concurrently run one
rcu_barrier(), each flavor needs its own per-CPU set of rcu_head
structures.  This commit therefore moves _rcu_barrier()'s set of
per-CPU rcu_head structures from per-CPU variables to the existing
per-CPU and per-RCU-flavor rcu_data structures.

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

index 00c518fa34bb655407e8d126507a81bc9e817e0a..1e552598b55d3a2b9fd8bf7d713c5dc9643d96a6 100644 (file)
@@ -157,7 +157,6 @@ unsigned long rcutorture_vernum;
 
 /* State information for rcu_barrier() and friends. */
 
-static DEFINE_PER_CPU(struct rcu_head, rcu_barrier_head) = {NULL};
 static atomic_t rcu_barrier_cpu_count;
 static DEFINE_MUTEX(rcu_barrier_mutex);
 static struct completion rcu_barrier_completion;
@@ -2282,12 +2281,11 @@ static void rcu_barrier_callback(struct rcu_head *notused)
  */
 static void rcu_barrier_func(void *type)
 {
-       int cpu = smp_processor_id();
-       struct rcu_head *head = &per_cpu(rcu_barrier_head, cpu);
        struct rcu_state *rsp = type;
+       struct rcu_data *rdp = __this_cpu_ptr(rsp->rda);
 
        atomic_inc(&rcu_barrier_cpu_count);
-       rsp->call(head, rcu_barrier_callback);
+       rsp->call(&rdp->barrier_head, rcu_barrier_callback);
 }
 
 /*
index 049896a835d9edd0958ad3711af895d1edb089e2..586d93c978f28c5aa673c0ebee8589a3bdcda7c6 100644 (file)
@@ -314,6 +314,9 @@ struct rcu_data {
        unsigned long n_rp_need_fqs;
        unsigned long n_rp_need_nothing;
 
+       /* 6) _rcu_barrier() callback. */
+       struct rcu_head barrier_head;
+
        int cpu;
        struct rcu_state *rsp;
 };