rcu: Make expedited GPs handle CPU 0 being offline
authorBoqun Feng <boqun.feng@gmail.com>
Fri, 15 Jun 2018 19:06:31 +0000 (12:06 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 12 Jul 2018 19:36:06 +0000 (12:36 -0700)
commitfcc63543650150629c8a873cbef3578770acecd9
tree0f71000b6ba8565a16ed3fc1a6af23d0cdf470e4
parent5257514d8885b2ebc11bf359ea1527282b47a5fd
rcu: Make expedited GPs handle CPU 0 being offline

Currently, the parallelized initialization of expedited grace periods uses
the workqueue associated with each rcu_node structure's ->grplo field.
This works fine unless that CPU is offline.  This commit therefore uses
the CPU corresponding to the lowest-numbered online CPU, or just queues
the work on WORK_CPU_UNBOUND if there are no online CPUs corresponding
to this rcu_node structure.

Note that this patch uses cpu_is_offline() instead of the usual approach
of checking bits in the rcu_node structure's ->qsmaskinitnext field.  This
is safe because preemption is disabled across both the cpu_is_offline()
check and the call to queue_work_on().

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
[ paulmck: Disable preemption to close offline race window. ]
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
[ paulmck: Apply Peter Zijlstra feedback on CPU selection. ]
Tested-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
kernel/rcu/tree_exp.h