diff options
author | Arend van Spriel <arend.vanspriel@broadcom.com> | 2019-03-31 23:12:42 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2019-06-27 22:55:27 +0200 |
commit | 71394eaf9191a2f8944900d8a738c32cff3c2e5b (patch) | |
tree | c8e625e952fbc27c0fd536571eeccccea241c7d1 /backport | |
parent | ab6761705d8f1d114058eb4a71f3e2e9cfdeeb9b (diff) |
backport: rcupdate: add rcu_head_init and rcu_head_after_call_rcu
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>
[Activate on < 4.20 only]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'backport')
-rw-r--r-- | backport/backport-include/linux/rcupdate.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/backport/backport-include/linux/rcupdate.h b/backport/backport-include/linux/rcupdate.h index b96ef496..cec4b3e8 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(4,20,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 /* < 4.20 */ + #endif /* __BACKPORT_LINUX_RCUPDATE_H */ |