Merge tag 'rcu.next.v6.10' of https://github.com/urezki/linux
[sfrench/cifs-2.6.git] / include / linux / rcupdate.h
index 17d7ed5f3ae6e5c612acd4261be763855069946d..dfd2399f2cde03f9807cd8aec2189b84f8e130fc 100644 (file)
@@ -401,15 +401,15 @@ static inline int debug_lockdep_rcu_enabled(void)
                }                                                       \
        } while (0)
 
-#if defined(CONFIG_PROVE_RCU) && !defined(CONFIG_PREEMPT_RCU)
+#ifndef CONFIG_PREEMPT_RCU
 static inline void rcu_preempt_sleep_check(void)
 {
        RCU_LOCKDEP_WARN(lock_is_held(&rcu_lock_map),
                         "Illegal context switch in RCU read-side critical section");
 }
-#else /* #ifdef CONFIG_PROVE_RCU */
+#else // #ifndef CONFIG_PREEMPT_RCU
 static inline void rcu_preempt_sleep_check(void) { }
-#endif /* #else #ifdef CONFIG_PROVE_RCU */
+#endif // #else // #ifndef CONFIG_PREEMPT_RCU
 
 #define rcu_sleep_check()                                              \
        do {                                                            \
@@ -809,9 +809,9 @@ static inline void rcu_read_unlock(void)
 {
        RCU_LOCKDEP_WARN(!rcu_is_watching(),
                         "rcu_read_unlock() used illegally while idle");
+       rcu_lock_release(&rcu_lock_map); /* Keep acq info for rls diags. */
        __release(RCU);
        __rcu_read_unlock();
-       rcu_lock_release(&rcu_lock_map); /* Keep acq info for rls diags. */
 }
 
 /**
@@ -1090,6 +1090,18 @@ rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f)
 extern int rcu_expedited;
 extern int rcu_normal;
 
-DEFINE_LOCK_GUARD_0(rcu, rcu_read_lock(), rcu_read_unlock())
+DEFINE_LOCK_GUARD_0(rcu,
+       do {
+               rcu_read_lock();
+               /*
+                * sparse doesn't call the cleanup function,
+                * so just release immediately and don't track
+                * the context. We don't need to anyway, since
+                * the whole point of the guard is to not need
+                * the explicit unlock.
+                */
+               __release(RCU);
+       } while (0),
+       rcu_read_unlock())
 
 #endif /* __LINUX_RCUPDATE_H */