1 #ifndef __TOOLS_LINUX_RCUPDATE_H
2 #define __TOOLS_LINUX_RCUPDATE_H
5 #include <linux/compiler.h>
7 #define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b))
9 #define rcu_dereference_check(p, c) rcu_dereference(p)
10 #define rcu_dereference_raw(p) rcu_dereference(p)
11 #define rcu_dereference_protected(p, c) rcu_dereference(p)
12 #define rcu_access_pointer(p) READ_ONCE(p)
14 #define kfree_rcu(ptr, rcu_head) kfree(ptr) /* XXX */
15 #define kvfree_rcu_mightsleep(ptr) kfree(ptr) /* XXX */
17 #define RCU_INIT_POINTER(p, v) WRITE_ONCE(p, v)
19 /* Has the specified rcu_head structure been handed to call_rcu()? */
22 * rcu_head_init - Initialize rcu_head for rcu_head_after_call_rcu()
23 * @rhp: The rcu_head structure to initialize.
25 * If you intend to invoke rcu_head_after_call_rcu() to test whether a
26 * given rcu_head structure has already been passed to call_rcu(), then
27 * you must also invoke this rcu_head_init() function on it just after
28 * allocating that structure. Calls to this function must not race with
29 * calls to call_rcu(), rcu_head_after_call_rcu(), or callback invocation.
31 static inline void rcu_head_init(struct rcu_head *rhp)
33 rhp->func = (void *)~0L;
37 rcu_head_after_call_rcu(struct rcu_head *rhp,
38 void (*f)(struct rcu_head *head))
40 void (*func)(struct rcu_head *head) = READ_ONCE(rhp->func);
47 #endif /* __TOOLS_LINUX_RCUPDATE_H */