Skip to content

Commit 9f08cf0

Browse files
fbqpaulmckrcu
authored andcommitted
rcu: Avoid modifying mask_ofl_ipi in sync_rcu_exp_select_node_cpus()
The "mask_ofl_ipi" is used to track which CPUs get IPIed, however in the IPI sending loop, "mask_ofl_ipi" along with another variable "mask_ofl_test" might also get modified to record which CPUs' quiesent states must be reported by the sync_rcu_exp_select_node_cpus() at the end of sync_rcu_exp_select_node_cpus(). This overlap of roles can be confusing, so this patch cleans things a little by using "mask_ofl_ipi" solely for determining which CPUs must be IPIed and "mask_ofl_test" for solely determining on behalf of which CPUs sync_rcu_exp_select_node_cpus() must report a quiscent state. Signed-off-by: Boqun Feng <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Reviewed-by: Joel Fernandes (Google) <[email protected]> Acked-by: Marco Elver <[email protected]>
1 parent 15c7c97 commit 9f08cf0

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

kernel/rcu/tree_exp.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,10 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp)
387387
}
388388
ret = smp_call_function_single(cpu, rcu_exp_handler, NULL, 0);
389389
put_cpu();
390-
if (!ret) {
391-
mask_ofl_ipi &= ~mask;
390+
/* The CPU will report the QS in response to the IPI. */
391+
if (!ret)
392392
continue;
393-
}
393+
394394
/* Failed, raced with CPU hotplug operation. */
395395
raw_spin_lock_irqsave_rcu_node(rnp, flags);
396396
if ((rnp->qsmaskinitnext & mask) &&
@@ -401,13 +401,12 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp)
401401
schedule_timeout_uninterruptible(1);
402402
goto retry_ipi;
403403
}
404-
/* CPU really is offline, so we can ignore it. */
405-
if (!(rnp->expmask & mask))
406-
mask_ofl_ipi &= ~mask;
404+
/* CPU really is offline, so we must report its QS. */
405+
if (rnp->expmask & mask)
406+
mask_ofl_test |= mask;
407407
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
408408
}
409409
/* Report quiescent states for those that went offline. */
410-
mask_ofl_test |= mask_ofl_ipi;
411410
if (mask_ofl_test)
412411
rcu_report_exp_cpu_mult(rnp, mask_ofl_test, false);
413412
}

0 commit comments

Comments
 (0)