[PATCH v2 01/10] rcu: Change rdp arg to cpu number for rcu_watching_snap_stopped_since()

From: neeraj . upadhyay
Date: Wed Oct 09 2024 - 08:55:50 EST


From: Neeraj Upadhyay <neeraj.upadhyay@xxxxxxxxxx>

In preparation of making rcu_watching_snap_stopped_since() available
for RCU code outside of tree.c, change the rdp argument to cpu number.

Signed-off-by: Neeraj Upadhyay <neeraj.upadhyay@xxxxxxxxxx>
---
kernel/rcu/tree.c | 14 +++++++-------
kernel/rcu/tree_exp.h | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index a60616e69b66..ea17dd2d0344 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -312,16 +312,16 @@ static bool rcu_watching_snap_in_eqs(int snap)
* rcu_watching_snap_stopped_since() - Has RCU stopped watching a given CPU
* since the specified @snap?
*
- * @rdp: The rcu_data corresponding to the CPU for which to check EQS.
+ * @cpu: The CPU for which to check EQS.
* @snap: rcu_watching snapshot taken when the CPU wasn't in an EQS.
*
- * Returns true if the CPU corresponding to @rdp has spent some time in an
- * extended quiescent state since @snap. Note that this doesn't check if it
- * /still/ is in an EQS, just that it went through one since @snap.
+ * Returns true if the CPU has spent some time in an extended quiescent state
+ * since @snap. Note that this doesn't check if it /still/ is in an EQS, just
+ * that it went through one since @snap.
*
* This is meant to be used in a loop waiting for a CPU to go through an EQS.
*/
-static bool rcu_watching_snap_stopped_since(struct rcu_data *rdp, int snap)
+static bool rcu_watching_snap_stopped_since(int cpu, int snap)
{
/*
* The first failing snapshot is already ordered against the accesses
@@ -334,7 +334,7 @@ static bool rcu_watching_snap_stopped_since(struct rcu_data *rdp, int snap)
if (WARN_ON_ONCE(rcu_watching_snap_in_eqs(snap)))
return true;

- return snap != ct_rcu_watching_cpu_acquire(rdp->cpu);
+ return snap != ct_rcu_watching_cpu_acquire(cpu);
}

/*
@@ -826,7 +826,7 @@ static int rcu_watching_snap_recheck(struct rcu_data *rdp)
* read-side critical section that started before the beginning
* of the current RCU grace period.
*/
- if (rcu_watching_snap_stopped_since(rdp, rdp->watching_snap)) {
+ if (rcu_watching_snap_stopped_since(rdp->cpu, rdp->watching_snap)) {
trace_rcu_fqs(rcu_state.name, rdp->gp_seq, rdp->cpu, TPS("dti"));
rcu_gpnum_ovf(rnp, rdp);
return 1;
diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
index fb664d3a01c9..e3bd4c18a852 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -401,7 +401,7 @@ static void __sync_rcu_exp_select_node_cpus(struct rcu_exp_work *rewp)
unsigned long mask = rdp->grpmask;

retry_ipi:
- if (rcu_watching_snap_stopped_since(rdp, rdp->exp_watching_snap)) {
+ if (rcu_watching_snap_stopped_since(rdp->cpu, rdp->exp_watching_snap)) {
mask_ofl_test |= mask;
continue;
}
--
2.40.1