[tip: perf/core] srcu: Add lock guard for srcu_fast_updown flavor

tip-bot2 for Puranjay Mohan posted 1 patch 2 months ago
include/linux/srcu.h | 7 +++++++
1 file changed, 7 insertions(+)
[tip: perf/core] srcu: Add lock guard for srcu_fast_updown flavor
Posted by tip-bot2 for Puranjay Mohan 2 months ago
The following commit has been merged into the perf/core branch of tip:

Commit-ID:     fa8a2d55139fb2e0b09e68c34b730adac92d18d6
Gitweb:        https://git.kernel.org/tip/fa8a2d55139fb2e0b09e68c34b730adac92d18d6
Author:        Puranjay Mohan <puranjay@kernel.org>
AuthorDate:    Mon, 06 Jul 2026 10:27:41 -07:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 03 Aug 2026 10:09:08 +02:00

srcu: Add lock guard for srcu_fast_updown flavor

Add a guard(srcu_fast_updown) definition for scoped
SRCU-fast-updown read-side critical sections, following the
existing pattern of guard(srcu) and guard(srcu_fast).

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Link: https://patch.msgid.link/20260706172744.3920417-2-puranjay@kernel.org
---
 include/linux/srcu.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index a54ce9e..72c86d3 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -638,4 +638,11 @@ DEFINE_LOCK_GUARD_1(srcu_fast_notrace, struct srcu_struct,
 DECLARE_LOCK_GUARD_1_ATTRS(srcu_fast_notrace, __acquires_shared(_T), __releases_shared(*(struct srcu_struct **)_T))
 #define class_srcu_fast_notrace_constructor(_T) WITH_LOCK_GUARD_1_ATTRS(srcu_fast_notrace, _T)
 
+DEFINE_LOCK_GUARD_1(srcu_fast_updown, struct srcu_struct,
+		    _T->scp = srcu_read_lock_fast_updown(_T->lock),
+		    srcu_read_unlock_fast_updown(_T->lock, _T->scp),
+		    struct srcu_ctr __percpu *scp)
+DECLARE_LOCK_GUARD_1_ATTRS(srcu_fast_updown, __acquires_shared(_T), __releases_shared(*(struct srcu_struct **)_T))
+#define class_srcu_fast_updown_constructor(_T) WITH_LOCK_GUARD_1_ATTRS(srcu_fast_updown, _T)
+
 #endif