summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-10-15 12:44:33 -0700
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-10-15 12:44:33 -0700
commit460aebac739df78b0e40a347934fdea377310577 (patch)
tree6082a8c5b5ecee1b8c3437f337f0cefca930f75f /include
parent4b0d3f0fde41a3c4454adb4d474618c23cfd4131 (diff)
parent5d5a08003d3e678372e375d99c65a24e0d33d2f5 (diff)
Merge branches 'doc.2013.09.25b' and 'fixes.2013.09.23b' into HEAD
doc.2013.09.25b: Topic branch for documentation updates. fixes.2013.09.23b: Topic branch for miscellaneous fixes.
Diffstat (limited to 'include')
-rw-r--r--include/linux/rculist.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 4106721c4e5e..45a0a9e81478 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -19,6 +19,21 @@
*/
/*
+ * INIT_LIST_HEAD_RCU - Initialize a list_head visible to RCU readers
+ * @list: list to be initialized
+ *
+ * You should instead use INIT_LIST_HEAD() for normal initialization and
+ * cleanup tasks, when readers have no access to the list being initialized.
+ * However, if the list being initialized is visible to readers, you
+ * need to keep the compiler from being too mischievous.
+ */
+static inline void INIT_LIST_HEAD_RCU(struct list_head *list)
+{
+ ACCESS_ONCE(list->next) = list;
+ ACCESS_ONCE(list->prev) = list;
+}
+
+/*
* return the ->next pointer of a list_head in an rcu safe
* way, we must not access it directly
*/
@@ -191,9 +206,13 @@ static inline void list_splice_init_rcu(struct list_head *list,
if (list_empty(list))
return;
- /* "first" and "last" tracking list, so initialize it. */
+ /*
+ * "first" and "last" tracking list, so initialize it. RCU readers
+ * have access to this list, so we must use INIT_LIST_HEAD_RCU()
+ * instead of INIT_LIST_HEAD().
+ */
- INIT_LIST_HEAD(list);
+ INIT_LIST_HEAD_RCU(list);
/*
* At this point, the list body still points to the source list.