On Mon, Oct 07, 2019 at 08:33:53PM -0700, Paul E. McKenney wrote: [...] > > --- > > kernel/rcu/tree_exp.h | 17 +++++++---------- > > 1 file changed, 7 insertions(+), 10 deletions(-) > > > > diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h > > index af7e7b9c86af..fb51752ac9a6 100644 > > --- a/kernel/rcu/tree_exp.h > > +++ b/kernel/rcu/tree_exp.h > > @@ -372,12 +372,10 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp) > > raw_spin_unlock_irqrestore_rcu_node(rnp, flags); > > > > /* IPI the remaining CPUs for expedited quiescent state. */ > > - for_each_leaf_node_cpu_mask(rnp, cpu, rnp->expmask) { > > + for_each_leaf_node_cpu_mask(rnp, cpu, mask_ofl_ipi) { > > unsigned long mask = leaf_node_cpu_bit(rnp, cpu); > > struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu); > > > > - if (!(mask_ofl_ipi & mask)) > > - continue; > > retry_ipi: > > if (rcu_dynticks_in_eqs_since(rdp, rdp->exp_dynticks_snap)) { > > mask_ofl_test |= mask; > > This part I have already on -rcu branch "dev". > > > @@ -389,10 +387,10 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp) > > } > > ret = smp_call_function_single(cpu, rcu_exp_handler, NULL, 0); > > put_cpu(); > > - if (!ret) { > > - mask_ofl_ipi &= ~mask; > > + /* the CPU responses the IPI, and it will report QS itself */ > > + if (!ret) > > continue; > > - } > > + > > /* Failed, raced with CPU hotplug operation. */ > > raw_spin_lock_irqsave_rcu_node(rnp, flags); > > if ((rnp->qsmaskinitnext & mask) && > > @@ -403,13 +401,12 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp) > > schedule_timeout_uninterruptible(1); > > goto retry_ipi; > > } > > - /* CPU really is offline, so we can ignore it. */ > > - if (!(rnp->expmask & mask)) > > - mask_ofl_ipi &= ~mask; > > + /* CPU really is offline, and we need its QS. */ > > + if (rnp->expmask & mask) > > + mask_ofl_test |= mask; > > raw_spin_unlock_irqrestore_rcu_node(rnp, flags); > > } > > /* Report quiescent states for those that went offline. */ > > - mask_ofl_test |= mask_ofl_ipi; > > if (mask_ofl_test) > > rcu_report_exp_cpu_mult(rnp, mask_ofl_test, false); > > } > > Would you be willing to port this optimization on top of current -rcu > branch "dev" with an suitably modified commit message? > Sure, will do ;-) Regards, Boqun > Thanx, Paul