diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-10-18 12:46:14 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-10-18 12:46:14 +0200 |
commit | 0e95c69bde1a5bf22acd53b356fe10d7bec6e2be (patch) | |
tree | 28c27057fc02a87b5e058b8cb17b2186f86fc95c /include/linux/rculist.h | |
parent | 04919afb85c8f007b7326c4da5eb61c52e91b9c7 (diff) | |
parent | 4102adab9189c8ea2f0cdd2f88345fd25d2790f1 (diff) |
Merge branch 'rcu/next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/rcu
Pull RCU updates from Paul E. McKenney.
Major changes:
" 1. Update RCU documentation. These were posted to LKML at
http://article.gmane.org/gmane.linux.kernel/1566994.
2. Miscellaneous fixes. These were posted to LKML at
http://article.gmane.org/gmane.linux.kernel/1567027.
3. Grace-period-related changes, primarily to aid in debugging,
inspired by a -rt debugging session. These were posted to
LKML at http://article.gmane.org/gmane.linux.kernel/1567076.
4. Idle entry/exit changes, primarily to address issues located
by Tibor Billes. These were posted to LKML at
http://article.gmane.org/gmane.linux.kernel/1567096.
5. Code reorganization moving RCU's source files from kernel
to kernel/rcu. This was posted to LKML at
http://article.gmane.org/gmane.linux.kernel/1577344."
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/rculist.h')
-rw-r--r-- | include/linux/rculist.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/include/linux/rculist.h b/include/linux/rculist.h index 4106721c4e5..45a0a9e8147 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. |