]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rcu: Make hotplug operations track GP state, not flags
authorPaul E. McKenney <paulmck@kernel.org>
Fri, 8 Mar 2024 19:15:01 +0000 (11:15 -0800)
committerUladzislau Rezki (Sony) <urezki@gmail.com>
Mon, 15 Apr 2024 14:48:28 +0000 (16:48 +0200)
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 <paulmck@kernel.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
kernel/rcu/tree.c
kernel/rcu/tree.h
kernel/rcu/tree_plugin.h

index 7149b2d5cdd69a8f94a65af14ac3e52e46a1404a..306f55b81d1012dda0c429b61aa9d95cf04e6325 100644 (file)
@@ -841,8 +841,8 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)
                                __func__, rnp1->grplo, rnp1->grphi, rnp1->qsmask, rnp1->qsmaskinit, rnp1->qsmaskinitnext, rnp1->rcu_gp_init_mask);
                pr_info("%s %d: %c online: %ld(%d) offline: %ld(%d)\n",
                        __func__, rdp->cpu, ".o"[rcu_rdp_cpu_online(rdp)],
-                       (long)rdp->rcu_onl_gp_seq, rdp->rcu_onl_gp_flags,
-                       (long)rdp->rcu_ofl_gp_seq, rdp->rcu_ofl_gp_flags);
+                       (long)rdp->rcu_onl_gp_seq, rdp->rcu_onl_gp_state,
+                       (long)rdp->rcu_ofl_gp_seq, rdp->rcu_ofl_gp_state);
                return 1; /* Break things loose after complaining. */
        }
 
@@ -4420,9 +4420,9 @@ rcu_boot_init_percpu_data(int cpu)
        WARN_ON_ONCE(rcu_dynticks_in_eqs(rcu_dynticks_snap(cpu)));
        rdp->barrier_seq_snap = rcu_state.barrier_sequence;
        rdp->rcu_ofl_gp_seq = rcu_state.gp_seq;
-       rdp->rcu_ofl_gp_flags = RCU_GP_CLEANED;
+       rdp->rcu_ofl_gp_state = RCU_GP_CLEANED;
        rdp->rcu_onl_gp_seq = rcu_state.gp_seq;
-       rdp->rcu_onl_gp_flags = RCU_GP_CLEANED;
+       rdp->rcu_onl_gp_state = RCU_GP_CLEANED;
        rdp->last_sched_clock = jiffies;
        rdp->cpu = cpu;
        rcu_boot_init_nocb_percpu_data(rdp);
@@ -4682,7 +4682,7 @@ void rcutree_report_cpu_starting(unsigned int cpu)
        ASSERT_EXCLUSIVE_WRITER(rcu_state.ncpus);
        rcu_gpnum_ovf(rnp, rdp); /* Offline-induced counter wrap? */
        rdp->rcu_onl_gp_seq = READ_ONCE(rcu_state.gp_seq);
-       rdp->rcu_onl_gp_flags = READ_ONCE(rcu_state.gp_flags);
+       rdp->rcu_onl_gp_state = READ_ONCE(rcu_state.gp_state);
 
        /* An incoming CPU should never be blocking a grace period. */
        if (WARN_ON_ONCE(rnp->qsmask & mask)) { /* RCU waiting on incoming CPU? */
@@ -4733,7 +4733,7 @@ void rcutree_report_cpu_dead(void)
        arch_spin_lock(&rcu_state.ofl_lock);
        raw_spin_lock_irqsave_rcu_node(rnp, flags); /* Enforce GP memory-order guarantee. */
        rdp->rcu_ofl_gp_seq = READ_ONCE(rcu_state.gp_seq);
-       rdp->rcu_ofl_gp_flags = READ_ONCE(rcu_state.gp_flags);
+       rdp->rcu_ofl_gp_state = READ_ONCE(rcu_state.gp_state);
        if (rnp->qsmask & mask) { /* RCU waiting on outgoing CPU? */
                /* Report quiescent state -before- changing ->qsmaskinitnext! */
                rcu_disable_urgency_upon_qs(rdp);
index df48160b3136dca1b668a3e0d275832ccc273dd3..ff4d8b60554b143357c059a7ba0b8d70737c26dd 100644 (file)
@@ -273,9 +273,9 @@ struct rcu_data {
        bool rcu_iw_pending;            /* Is ->rcu_iw pending? */
        unsigned long rcu_iw_gp_seq;    /* ->gp_seq associated with ->rcu_iw. */
        unsigned long rcu_ofl_gp_seq;   /* ->gp_seq at last offline. */
-       short rcu_ofl_gp_flags;         /* ->gp_flags at last offline. */
+       short rcu_ofl_gp_state;         /* ->gp_state at last offline. */
        unsigned long rcu_onl_gp_seq;   /* ->gp_seq at last online. */
-       short rcu_onl_gp_flags;         /* ->gp_flags at last online. */
+       short rcu_onl_gp_state;         /* ->gp_state at last online. */
        unsigned long last_fqs_resched; /* Time of last rcu_resched(). */
        unsigned long last_sched_clock; /* Jiffies of last rcu_sched_clock_irq(). */
        struct rcu_snap_record snap_record; /* Snapshot of core stats at half of */
index 36a8b5dbf5b52ecff9e879f102a53fa6cd264474..340bbefe5f652d99ef87a5db168eb960a8fa5f30 100644 (file)
@@ -805,8 +805,8 @@ dump_blkd_tasks(struct rcu_node *rnp, int ncheck)
                rdp = per_cpu_ptr(&rcu_data, cpu);
                pr_info("\t%d: %c online: %ld(%d) offline: %ld(%d)\n",
                        cpu, ".o"[rcu_rdp_cpu_online(rdp)],
-                       (long)rdp->rcu_onl_gp_seq, rdp->rcu_onl_gp_flags,
-                       (long)rdp->rcu_ofl_gp_seq, rdp->rcu_ofl_gp_flags);
+                       (long)rdp->rcu_onl_gp_seq, rdp->rcu_onl_gp_state,
+                       (long)rdp->rcu_ofl_gp_seq, rdp->rcu_ofl_gp_state);
        }
 }