rcu: Use DEFINE_PER_CPU_SHARED_ALIGNED for rcu_data
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 4 Sep 2014 19:21:41 +0000 (12:21 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 4 Nov 2014 03:20:03 +0000 (19:20 -0800)
The rcu_data per-CPU variable has a number of fields that are atomically
manipulated, potentially by any CPU.  This situation can result in false
sharing with per-CPU variables that have the misfortune of being allocated
adjacent to rcu_data in memory.  This commit therefore changes the
DEFINE_PER_CPU() to DEFINE_PER_CPU_SHARED_ALIGNED() in order to avoid
this false sharing.

Reported-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Reviewed-by: Pranith Kumar <bobby.prani@gmail.com>
kernel/rcu/tree.c

index c0673c56fb1ae7e8cb5ae163f209800858451cd9..ab6fcfb4fe11c45f766c5f4c32a9542216f3d961 100644 (file)
@@ -105,7 +105,7 @@ struct rcu_state sname##_state = { \
        .name = RCU_STATE_NAME(sname), \
        .abbr = sabbr, \
 }; \
-DEFINE_PER_CPU(struct rcu_data, sname##_data)
+DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_data, sname##_data)
 
 RCU_STATE_INITIALIZER(rcu_sched, 's', call_rcu_sched);
 RCU_STATE_INITIALIZER(rcu_bh, 'b', call_rcu_bh);