Skip to content

Commit 082acfe

Browse files
Matthew Wilcox (Oracle)Frederic Weisbecker
authored andcommitted
rcu: Describe listRCU read-side guarantees
More explicitly state what is, and what is not guaranteed to those who iterate a list while protected by RCU. [ paulmck: Apply Joel Fernandes feedback. ] Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
1 parent ebbb9d3 commit 082acfe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Documentation/RCU/listRCU.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ One of the most common uses of RCU is protecting read-mostly linked lists
88
that all of the required memory ordering is provided by the list macros.
99
This document describes several list-based RCU use cases.
1010

11+
When iterating a list while holding the rcu_read_lock(), writers may
12+
modify the list. The reader is guaranteed to see all of the elements
13+
which were added to the list before they acquired the rcu_read_lock()
14+
and are still on the list when they drop the rcu_read_unlock().
15+
Elements which are added to, or removed from the list may or may not
16+
be seen. If the writer calls list_replace_rcu(), the reader may see
17+
either the old element or the new element; they will not see both,
18+
nor will they see neither.
19+
1120

1221
Example 1: Read-mostly list: Deferred Destruction
1322
-------------------------------------------------

0 commit comments

Comments
 (0)