diff mbox series

[3/8] rcu: Move rcu_report_exp_rdp() setting of ->cpu_no_qs.b.exp under lock

Message ID 20241212183936.1936196-3-paulmck@kernel.org (mailing list archive)
State New
Headers show
Series Miscellaneous fixes for v6.14 | expand

Commit Message

Paul E. McKenney Dec. 12, 2024, 6:39 p.m. UTC
This commit reduces the state space of rcu_report_exp_rdp() by moving
the setting of ->cpu_no_qs.b.exp under the rcu_node structure's ->lock.
The lock isn't really all that important here, given that this per-CPU
field is supposed to be written only by its CPU, but the disabling of
interrupts excludes things like rcu_exp_handler(), which also can write
to this same field.  Avoiding this sort of interleaved access reduces
the state space.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
---
 kernel/rcu/tree_exp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
index 581e88d39542d..5c4ea66cc00dd 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -260,8 +260,8 @@  static void rcu_report_exp_rdp(struct rcu_data *rdp)
 	unsigned long flags;
 	struct rcu_node *rnp = rdp->mynode;
 
-	WRITE_ONCE(rdp->cpu_no_qs.b.exp, false);
 	raw_spin_lock_irqsave_rcu_node(rnp, flags);
+	WRITE_ONCE(rdp->cpu_no_qs.b.exp, false);
 	rcu_report_exp_cpu_mult(rnp, flags, rdp->grpmask, true);
 }