rcu: Make expedited RCU CPU selection avoid unnecessary stores
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 1 Feb 2018 04:24:15 +0000 (20:24 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 21 Feb 2018 00:12:29 +0000 (16:12 -0800)
commit65963d246147c46aafda2b04523d6dbe6c457e7c
tree1378427fb1a730e749d6cde5c8298a49a406e5f3
parent7f5d42d05155523a4c42c2c5170f2a368217aed5
rcu: Make expedited RCU CPU selection avoid unnecessary stores

This commit reworks the first loop in sync_rcu_exp_select_cpus()
to avoid doing unnecssary stores to other CPUs' rcu_data
structures.  This speeds up that first loop by roughly a factor of
two on an old x86 system.  In the case where the system is mostly
idle, this loop incurs a large fraction of the overhead of the
synchronize_rcu_expedited().  There is less benefit on busy systems
because the overhead of the smp_call_function_single() in the second
loop dominates in that case.

However, it is not unusual to do configuration chances involving
RCU grace periods (both expedited and normal) while the system is
mostly idle, so this optimization is worth doing.

While we are in the area, this commit also adds parentheses to arguments
used by the for_each_leaf_node_possible_cpu() macro.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcu/rcu.h
kernel/rcu/tree_exp.h