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 kfree_rcu_mightsleep(ptr) kfree(ptr) /* XXX */
16 #define kvfree_rcu_mightsleep(ptr) kfree(ptr) /* XXX */
18 #define RCU_INIT_POINTER(p, v) WRITE_ONCE(p, v)
20 /* Has the specified rcu_head structure been handed to call_rcu()? */
23 * rcu_head_init - Initialize rcu_head for rcu_head_after_call_rcu()
24 * @rhp: The rcu_head structure to initialize.
26 * If you intend to invoke rcu_head_after_call_rcu() to test whether a
27 * given rcu_head structure has already been passed to call_rcu(), then
28 * you must also invoke this rcu_head_init() function on it just after
29 * allocating that structure. Calls to this function must not race with
30 * calls to call_rcu(), rcu_head_after_call_rcu(), or callback invocation.
32 static inline void rcu_head_init(struct rcu_head *rhp)
34 rhp->func = (void *)~0L;
38 rcu_head_after_call_rcu(struct rcu_head *rhp,
39 void (*f)(struct rcu_head *head))
41 void (*func)(struct rcu_head *head) = READ_ONCE(rhp->func);
48 #endif /* __TOOLS_LINUX_RCUPDATE_H */