]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rcu: Better define "atomic" for list replacement
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 3 Jul 2024 01:49:35 +0000 (18:49 -0700)
committerNeeraj Upadhyay <neeraj.upadhyay@kernel.org>
Wed, 31 Jul 2024 15:48:57 +0000 (21:18 +0530)
The kernel-doc headers for list_replace_rcu() and hlist_replace_rcu()
claim that the replacement is atomic, which it is, but only for readers.
Avoid confusion by making it clear that the atomic nature of these
functions applies only to readers, not to concurrent updaters.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Neeraj Upadhyay <neeraj.upadhyay@kernel.org>
include/linux/rculist.h

index 3dc1e58865f77b957d7a626ad57ad4a1c10df42d..14dfa6008467e803d57f98cfa0275569f1c6a181 100644 (file)
@@ -191,7 +191,10 @@ static inline void hlist_del_init_rcu(struct hlist_node *n)
  * @old : the element to be replaced
  * @new : the new element to insert
  *
- * The @old entry will be replaced with the @new entry atomically.
+ * The @old entry will be replaced with the @new entry atomically from
+ * the perspective of concurrent readers.  It is the caller's responsibility
+ * to synchronize with concurrent updaters, if any.
+ *
  * Note: @old should not be empty.
  */
 static inline void list_replace_rcu(struct list_head *old,
@@ -519,7 +522,9 @@ static inline void hlist_del_rcu(struct hlist_node *n)
  * @old : the element to be replaced
  * @new : the new element to insert
  *
- * The @old entry will be replaced with the @new entry atomically.
+ * The @old entry will be replaced with the @new entry atomically from
+ * the perspective of concurrent readers.  It is the caller's responsibility
+ * to synchronize with concurrent updaters, if any.
  */
 static inline void hlist_replace_rcu(struct hlist_node *old,
                                        struct hlist_node *new)