summaryrefslogtreecommitdiffstats
path: root/backport-include/linux/rcupdate.h
diff options
context:
space:
mode:
authorroot <root@artemis.panaceas.org>2015-12-25 15:00:15 +0000
committerroot <root@artemis.panaceas.org>2015-12-25 15:00:15 +0000
commitddd86436f4e3643c04b797f858dab95d5f2e4de9 (patch)
treebfe7a780cf9a2f4fc33aec32c82e625e79dece1f /backport-include/linux/rcupdate.h
downloadbackports-3.10.19-1-master.tar.gz
backports-3.10.19-1-master.tar.bz2
backports-3.10.19-1-master.zip
Diffstat (limited to 'backport-include/linux/rcupdate.h')
-rw-r--r--backport-include/linux/rcupdate.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/backport-include/linux/rcupdate.h b/backport-include/linux/rcupdate.h
new file mode 100644
index 0000000..d6d9262
--- /dev/null
+++ b/backport-include/linux/rcupdate.h
@@ -0,0 +1,51 @@
+#ifndef __BACKPORT_LINUX_RCUPDATE_H
+#define __BACKPORT_LINUX_RCUPDATE_H
+#include_next <linux/rcupdate.h>
+
+/*
+ * This adds a nested function everywhere kfree_rcu() was called. This
+ * function frees the memory and is given as a function to call_rcu().
+ * The rcu callback could happen every time also after the module was
+ * unloaded and this will cause problems. To address that problem, we
+ * put rcu_barrier() into each module_exit() in module.h.
+ */
+#if !defined(kfree_rcu)
+#define kfree_rcu(data, rcuhead) do { \
+ void __kfree_rcu_fn(struct rcu_head *rcu_head) \
+ { \
+ void *___ptr; \
+ ___ptr = container_of(rcu_head, typeof(*(data)), rcuhead);\
+ kfree(___ptr); \
+ } \
+ call_rcu(&(data)->rcuhead, __kfree_rcu_fn); \
+ } while (0)
+#endif
+
+#ifndef RCU_INIT_POINTER
+#define RCU_INIT_POINTER(p, v) \
+ p = (typeof(*v) __force __rcu *)(v)
+#endif
+
+#ifndef rcu_dereference_check
+#define rcu_dereference_check(p, c) rcu_dereference(p)
+#endif
+
+#ifndef rcu_dereference_protected
+#define rcu_dereference_protected(p, c) (p)
+#endif
+#ifndef rcu_access_pointer
+#define rcu_access_pointer(p) ACCESS_ONCE(p)
+#endif
+
+#ifndef rcu_dereference_raw
+#define rcu_dereference_raw(p) rcu_dereference(p)
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
+static inline int rcu_read_lock_held(void)
+{
+ return 1;
+}
+#endif
+
+#endif /* __BACKPORT_LINUX_RCUPDATE_H */