Skip to contentSkip to conversation

srcu: Remove check from srcu_dereference_check()

PATCH In review Bart Van Assche 2 participants 2 messages May 2 – May 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 srcu: Remove check from srcu_dereference_check()

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")
---
 include/linux/srcu.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/srcu.h +0 -1
index 81b1938512d5..51864281164b 100644
@@ -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);	\
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Bart Van Assche

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")

Fair enough:

Quoted 16 lines
---
 include/linux/srcu.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/srcu.h +0 -1
index 81b1938512d5..51864281164b 100644
@@ -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);        \