From: Paul E. McKenney Date: Wed, 5 Nov 2025 20:32:05 +0000 (-0800) Subject: srcu: Make grace-period determination use ssp->srcu_reader_flavor X-Git-Url: https://gentwo.org/gitweb/?a=commitdiff_plain;h=c5fee33f884c6e29e9c351a3a8f080d8178544d0;p=linux%2F.git srcu: Make grace-period determination use ssp->srcu_reader_flavor This commit causes the srcu_readers_unlock_idx() function to take the srcu_struct structure's ->srcu_reader_flavor field into account. This ensures that structures defined via DEFINE_SRCU_FAST( or initialized via init_srcu_struct_fast() have their grace periods use synchronize_srcu() or synchronize_srcu_expedited() instead of smp_mb(), even before the first SRCU reader has been entered. Signed-off-by: Paul E. McKenney Cc: Mathieu Desnoyers Cc: Steven Rostedt Cc: Sebastian Andrzej Siewior Cc: Signed-off-by: Frederic Weisbecker --- diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c index 9869a13b8763..c29203b23d1a 100644 --- a/kernel/rcu/srcutree.c +++ b/kernel/rcu/srcutree.c @@ -490,7 +490,7 @@ static bool srcu_readers_lock_idx(struct srcu_struct *ssp, int idx, bool gp, uns static unsigned long srcu_readers_unlock_idx(struct srcu_struct *ssp, int idx, unsigned long *rdm) { int cpu; - unsigned long mask = 0; + unsigned long mask = ssp->srcu_reader_flavor; unsigned long sum = 0; for_each_possible_cpu(cpu) {