Linux RCU subsystem development
 help / color / mirror / Atom feed
* [PATCH] srcu: Remove check from srcu_dereference_check()
@ 2026-05-02  1:57 Bart Van Assche
  2026-05-04 21:10 ` Marco Elver
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2026-05-02  1:57 UTC (permalink / raw)
  To: Paul E . McKenney
  Cc: Marco Elver, rcu, Bart Van Assche, Lai Jiangshan, Josh Triplett,
	Peter Zijlstra (Intel)

Users of srcu_dereference_check() must hold either an SRCU reader lock
or hold the update-side lock. __srcu_read_lock_must_hold() checks
whether the SRCU reader lock is held. Since that check is too strict,
remove it.

Fixes: f0b7ce22d718 ("srcu: Support Clang's context analysis")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/linux/srcu.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 81b1938512d5..51864281164b 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -235,7 +235,6 @@ static inline void __srcu_read_lock_must_hold(const struct srcu_struct *ssp) __m
  */
 #define srcu_dereference_check(p, ssp, c)					\
 ({										\
-	__srcu_read_lock_must_hold(ssp);					\
 	__acquire_shared_ctx_lock(RCU);					\
 	__auto_type __v = __rcu_dereference_check((p), __UNIQUE_ID(rcu),	\
 				(c) || srcu_read_lock_held(ssp), __rcu);	\

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] srcu: Remove check from srcu_dereference_check()
  2026-05-02  1:57 [PATCH] srcu: Remove check from srcu_dereference_check() Bart Van Assche
@ 2026-05-04 21:10 ` Marco Elver
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Elver @ 2026-05-04 21:10 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Paul E . McKenney, rcu, Lai Jiangshan, Josh Triplett,
	Peter Zijlstra (Intel)

On Sat, 2 May 2026 at 03:57, Bart Van Assche <bvanassche@acm.org> wrote:
>
> Users of srcu_dereference_check() must hold either an SRCU reader lock
> or hold the update-side lock. __srcu_read_lock_must_hold() checks
> whether the SRCU reader lock is held. Since that check is too strict,
> remove it.
>
> Fixes: f0b7ce22d718 ("srcu: Support Clang's context analysis")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Fair enough:

Acked-by: Marco Elver <elver@google.com>

> ---
>  include/linux/srcu.h | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/include/linux/srcu.h b/include/linux/srcu.h
> index 81b1938512d5..51864281164b 100644
> --- a/include/linux/srcu.h
> +++ b/include/linux/srcu.h
> @@ -235,7 +235,6 @@ static inline void __srcu_read_lock_must_hold(const struct srcu_struct *ssp) __m
>   */
>  #define srcu_dereference_check(p, ssp, c)                                      \
>  ({                                                                             \
> -       __srcu_read_lock_must_hold(ssp);                                        \
>         __acquire_shared_ctx_lock(RCU);                                 \
>         __auto_type __v = __rcu_dereference_check((p), __UNIQUE_ID(rcu),        \
>                                 (c) || srcu_read_lock_held(ssp), __rcu);        \

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-04 21:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-02  1:57 [PATCH] srcu: Remove check from srcu_dereference_check() Bart Van Assche
2026-05-04 21:10 ` Marco Elver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox