diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2023-08-22 21:04:02 +0100 |
---|---|---|
committer | Frederic Weisbecker <frederic@kernel.org> | 2023-09-11 23:09:35 +0200 |
commit | 082acfe39cb0090e97bf27057d0efdf1e89abbef (patch) | |
tree | 4d528fa8e4ab6e83abf31170821539d17055d0db /Documentation/RCU | |
parent | ebbb9d35fd8497591760779b3d5275fb4ce0e50d (diff) | |
download | lwn-082acfe39cb0090e97bf27057d0efdf1e89abbef.tar.gz lwn-082acfe39cb0090e97bf27057d0efdf1e89abbef.zip |
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>
Diffstat (limited to 'Documentation/RCU')
-rw-r--r-- | Documentation/RCU/listRCU.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Documentation/RCU/listRCU.rst b/Documentation/RCU/listRCU.rst index bdc4bcc5289f..ed5c9d8c9afe 100644 --- a/Documentation/RCU/listRCU.rst +++ b/Documentation/RCU/listRCU.rst @@ -8,6 +8,15 @@ One of the most common uses of RCU is protecting read-mostly linked lists that all of the required memory ordering is provided by the list macros. This document describes several list-based RCU use cases. +When iterating a list while holding the rcu_read_lock(), writers may +modify the list. The reader is guaranteed to see all of the elements +which were added to the list before they acquired the rcu_read_lock() +and are still on the list when they drop the rcu_read_unlock(). +Elements which are added to, or removed from the list may or may not +be seen. If the writer calls list_replace_rcu(), the reader may see +either the old element or the new element; they will not see both, +nor will they see neither. + Example 1: Read-mostly list: Deferred Destruction ------------------------------------------------- |