summaryrefslogtreecommitdiff
path: root/include/linux/srcutree.h
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2025-11-05 23:32:08 +0300
committerFrederic Weisbecker <frederic@kernel.org>2025-11-06 01:58:28 +0300
commitac51c40c2c148a75f3191ff401c9889a7fc12cb1 (patch)
tree0182fb55fc012a092ff2f36c94a64ef29e224242 /include/linux/srcutree.h
parent8235bcfd39e865763e764b4c968012bdfb808af1 (diff)
downloadlinux-ac51c40c2c148a75f3191ff401c9889a7fc12cb1.tar.xz
srcu: Make SRCU-fast readers enforce use of SRCU-fast definition/init
This commit makes CONFIG_PROVE_RCU=y kernels enforce the new rule that srcu_struct structures that are passed to srcu_read_lock_fast() and other SRCU-fast read-side markers be either initialized with init_srcu_struct_fast() on the one hand or defined with DEFINE_SRCU_FAST() or DEFINE_STATIC_SRCU_FAST() on the other. This eliminates the read-side test that was formerly included in srcu_read_lock_fast() and friends, speeding these primitives up by about 25% (admittedly only about half of a nanosecond, but when tracing on fastpaths...) Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: <bpf@vger.kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Diffstat (limited to 'include/linux/srcutree.h')
-rw-r--r--include/linux/srcutree.h16
1 files changed, 1 insertions, 15 deletions
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h
index 7ff4a11bc5a3..6080a9094618 100644
--- a/include/linux/srcutree.h
+++ b/include/linux/srcutree.h
@@ -307,21 +307,7 @@ __srcu_read_unlock_fast(struct srcu_struct *ssp, struct srcu_ctr __percpu *scp)
void __srcu_check_read_flavor(struct srcu_struct *ssp, int read_flavor);
-// Record reader usage even for CONFIG_PROVE_RCU=n kernels. This is
-// needed only for flavors that require grace-period smp_mb() calls to be
-// promoted to synchronize_rcu().
-static inline void srcu_check_read_flavor_force(struct srcu_struct *ssp, int read_flavor)
-{
- struct srcu_data *sdp = raw_cpu_ptr(ssp->sda);
-
- if (likely(READ_ONCE(sdp->srcu_reader_flavor) & read_flavor))
- return;
-
- // Note that the cmpxchg() in __srcu_check_read_flavor() is fully ordered.
- __srcu_check_read_flavor(ssp, read_flavor);
-}
-
-// Record non-_lite() usage only for CONFIG_PROVE_RCU=y kernels.
+// Record SRCU-reader usage type only for CONFIG_PROVE_RCU=y kernels.
static inline void srcu_check_read_flavor(struct srcu_struct *ssp, int read_flavor)
{
if (IS_ENABLED(CONFIG_PROVE_RCU))