diff mbox series

[3/3] backport: rcupdate: add rcu_head_init and rcu_head_after_call_rcu

Message ID 1554066762-20128-3-git-send-email-arend.vanspriel@broadcom.com (mailing list archive)
State Accepted
Headers show
Series [1/3] patches: update select queue patches | expand

Commit Message

Arend van Spriel March 31, 2019, 9:12 p.m. UTC
Include static inline functions that were added by commit
74de6960c99d ("rcu: Provide functions for determining if call_rcu()
has been invoked").

Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
 backport/backport-include/linux/rcupdate.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/backport/backport-include/linux/rcupdate.h b/backport/backport-include/linux/rcupdate.h
index b96ef49..8b9c94e 100644
--- a/backport/backport-include/linux/rcupdate.h
+++ b/backport/backport-include/linux/rcupdate.h
@@ -41,4 +41,22 @@ 
 #define rcu_dereference_raw(p)	rcu_dereference(p)
 #endif
 
+#if LINUX_VERSION_IS_LESS(5,2,0)
+typedef void (*rcu_callback_t)(struct rcu_head *head);
+
+static inline void rcu_head_init(struct rcu_head *rhp)
+{
+        rhp->func = (rcu_callback_t)~0L;
+}
+
+static inline bool
+rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f)
+{
+        if (READ_ONCE(rhp->func) == f)
+                return true;
+        WARN_ON_ONCE(READ_ONCE(rhp->func) != (rcu_callback_t)~0L);
+        return false;
+}
+#endif
+
 #endif /* __BACKPORT_LINUX_RCUPDATE_H */