Re: [PATCH tip/core/rcu 2/2] rcu: Make expedited GPs handle CPU 0 being offline

From: Peter Zijlstra
Date: Tue Jun 26 2018 - 05:38:50 EST


On Mon, Jun 25, 2018 at 03:43:32PM -0700, Paul E. McKenney wrote:
> + preempt_disable();
> + for_each_leaf_node_possible_cpu(rnp, cpu) {
> + if (cpu_is_offline(cpu)) /* Preemption disabled. */
> + continue;

Create for_each_node_online_cpu() instead? Seems a bit pointless to
iterate possible mask only to then check it against the online mask.
Just iterate the online mask directly.

Or better yet, write this as:

preempt_disable();
cpu = cpumask_next(rnp->grplo - 1, cpu_online_mask);
if (cpu > rnp->grphi)
cpu = WORK_CPU_UNBOUND;
queue_work_on(cpu, rcu_par_gp_wq, &rnp->rew.rew_work);
preempt_enable();

Which is what it appears to be doing.

> + queue_work_on(cpu, rcu_par_gp_wq, &rnp->rew.rew_work);
> + rnp->exp_need_flush = true;
> + break;
> + }
> + preempt_enable();
> + if (!rnp->exp_need_flush) { /* All offline, report QSes. */
> + queue_work(rcu_par_gp_wq, &rnp->rew.rew_work);
> + rnp->exp_need_flush = true;
> + }
> }
>
> /* Wait for workqueue jobs (if any) to complete. */
> --
> 2.17.1
>