Skip to content

Commit ae2b217

Browse files
paulmckrcuurezki
authored andcommitted
rcu: Make hotplug operations track GP state, not flags
Currently, there are rcu_data structure fields named ->rcu_onl_gp_seq and ->rcu_ofl_gp_seq that track the rcu_state.gp_flags field at the time of the corresponding CPU's last online or offline operation, respectively. However, this information is not particularly useful. It would be better to instead track the grace period state kept in rcu_state.gp_state. This would also be consistent with the initialization in rcu_boot_init_percpu_data(), which is to RCU_GP_CLEANED (an rcu_state.gp_state value), and also with the diagnostics in rcu_implicit_dynticks_qs(), whose format is consistent with an integer, not a bitmask. This commit therefore makes this change and changes the names to ->rcu_onl_gp_flags and ->rcu_ofl_gp_flags, respectively. Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Uladzislau Rezki (Sony) <[email protected]>
1 parent 09e077c commit ae2b217

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

kernel/rcu/tree.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,8 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)
841841
__func__, rnp1->grplo, rnp1->grphi, rnp1->qsmask, rnp1->qsmaskinit, rnp1->qsmaskinitnext, rnp1->rcu_gp_init_mask);
842842
pr_info("%s %d: %c online: %ld(%d) offline: %ld(%d)\n",
843843
__func__, rdp->cpu, ".o"[rcu_rdp_cpu_online(rdp)],
844-
(long)rdp->rcu_onl_gp_seq, rdp->rcu_onl_gp_flags,
845-
(long)rdp->rcu_ofl_gp_seq, rdp->rcu_ofl_gp_flags);
844+
(long)rdp->rcu_onl_gp_seq, rdp->rcu_onl_gp_state,
845+
(long)rdp->rcu_ofl_gp_seq, rdp->rcu_ofl_gp_state);
846846
return 1; /* Break things loose after complaining. */
847847
}
848848

@@ -4420,9 +4420,9 @@ rcu_boot_init_percpu_data(int cpu)
44204420
WARN_ON_ONCE(rcu_dynticks_in_eqs(rcu_dynticks_snap(cpu)));
44214421
rdp->barrier_seq_snap = rcu_state.barrier_sequence;
44224422
rdp->rcu_ofl_gp_seq = rcu_state.gp_seq;
4423-
rdp->rcu_ofl_gp_flags = RCU_GP_CLEANED;
4423+
rdp->rcu_ofl_gp_state = RCU_GP_CLEANED;
44244424
rdp->rcu_onl_gp_seq = rcu_state.gp_seq;
4425-
rdp->rcu_onl_gp_flags = RCU_GP_CLEANED;
4425+
rdp->rcu_onl_gp_state = RCU_GP_CLEANED;
44264426
rdp->last_sched_clock = jiffies;
44274427
rdp->cpu = cpu;
44284428
rcu_boot_init_nocb_percpu_data(rdp);
@@ -4682,7 +4682,7 @@ void rcutree_report_cpu_starting(unsigned int cpu)
46824682
ASSERT_EXCLUSIVE_WRITER(rcu_state.ncpus);
46834683
rcu_gpnum_ovf(rnp, rdp); /* Offline-induced counter wrap? */
46844684
rdp->rcu_onl_gp_seq = READ_ONCE(rcu_state.gp_seq);
4685-
rdp->rcu_onl_gp_flags = READ_ONCE(rcu_state.gp_flags);
4685+
rdp->rcu_onl_gp_state = READ_ONCE(rcu_state.gp_state);
46864686

46874687
/* An incoming CPU should never be blocking a grace period. */
46884688
if (WARN_ON_ONCE(rnp->qsmask & mask)) { /* RCU waiting on incoming CPU? */
@@ -4733,7 +4733,7 @@ void rcutree_report_cpu_dead(void)
47334733
arch_spin_lock(&rcu_state.ofl_lock);
47344734
raw_spin_lock_irqsave_rcu_node(rnp, flags); /* Enforce GP memory-order guarantee. */
47354735
rdp->rcu_ofl_gp_seq = READ_ONCE(rcu_state.gp_seq);
4736-
rdp->rcu_ofl_gp_flags = READ_ONCE(rcu_state.gp_flags);
4736+
rdp->rcu_ofl_gp_state = READ_ONCE(rcu_state.gp_state);
47374737
if (rnp->qsmask & mask) { /* RCU waiting on outgoing CPU? */
47384738
/* Report quiescent state -before- changing ->qsmaskinitnext! */
47394739
rcu_disable_urgency_upon_qs(rdp);

kernel/rcu/tree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ struct rcu_data {
273273
bool rcu_iw_pending; /* Is ->rcu_iw pending? */
274274
unsigned long rcu_iw_gp_seq; /* ->gp_seq associated with ->rcu_iw. */
275275
unsigned long rcu_ofl_gp_seq; /* ->gp_seq at last offline. */
276-
short rcu_ofl_gp_flags; /* ->gp_flags at last offline. */
276+
short rcu_ofl_gp_state; /* ->gp_state at last offline. */
277277
unsigned long rcu_onl_gp_seq; /* ->gp_seq at last online. */
278-
short rcu_onl_gp_flags; /* ->gp_flags at last online. */
278+
short rcu_onl_gp_state; /* ->gp_state at last online. */
279279
unsigned long last_fqs_resched; /* Time of last rcu_resched(). */
280280
unsigned long last_sched_clock; /* Jiffies of last rcu_sched_clock_irq(). */
281281
struct rcu_snap_record snap_record; /* Snapshot of core stats at half of */

kernel/rcu/tree_plugin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,8 @@ dump_blkd_tasks(struct rcu_node *rnp, int ncheck)
805805
rdp = per_cpu_ptr(&rcu_data, cpu);
806806
pr_info("\t%d: %c online: %ld(%d) offline: %ld(%d)\n",
807807
cpu, ".o"[rcu_rdp_cpu_online(rdp)],
808-
(long)rdp->rcu_onl_gp_seq, rdp->rcu_onl_gp_flags,
809-
(long)rdp->rcu_ofl_gp_seq, rdp->rcu_ofl_gp_flags);
808+
(long)rdp->rcu_onl_gp_seq, rdp->rcu_onl_gp_state,
809+
(long)rdp->rcu_ofl_gp_seq, rdp->rcu_ofl_gp_state);
810810
}
811811
}
812812

0 commit comments

Comments
 (0)