mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rculist: unify documentation about missing list_empty_rcu()
@ 2021-05-21 10:08 Julian Wiedmann
  2021-05-21 17:56 ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Wiedmann @ 2021-05-21 10:08 UTC (permalink / raw)
  To: Paul E. McKenney, Josh Triplett
  Cc: Julian Wiedmann, Steven Rostedt, Mathieu Desnoyers,
	Lai Jiangshan, Joel Fernandes, rcu, linux-kernel

We have two separate sections that talk about why list_empty_rcu()
is not needed, consolidate them.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 include/linux/rculist.h | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index f8633d37e358..f8f42ce04382 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -10,15 +10,6 @@
 #include <linux/list.h>
 #include <linux/rcupdate.h>
 
-/*
- * Why is there no list_empty_rcu()?  Because list_empty() serves this
- * purpose.  The list_empty() function fetches the RCU-protected pointer
- * and compares it to the address of the list head, but neither dereferences
- * this pointer itself nor provides this pointer to the caller.  Therefore,
- * it is not necessary to use rcu_dereference(), so that list_empty() can
- * be used anywhere you would want to use a list_empty_rcu().
- */
-
 /*
  * INIT_LIST_HEAD_RCU - Initialize a list_head visible to RCU readers
  * @list: list to be initialized
@@ -334,6 +325,12 @@ static inline void list_splice_tail_init_rcu(struct list_head *list,
  * list_first_entry() because they would be protected by a lock that blocks
  * writers.
  *
+ * list_empty() fetches the RCU-protected pointer and compares it to the address
+ * of the list head. But it neither dereferences this pointer itself, nor
+ * provides this pointer to the caller. Therefore it is not necessary to use
+ * rcu_dereference(), and list_empty() can be used anywhere you would want to
+ * use a list_empty_rcu().
+ *
  * See list_first_or_null_rcu for an alternative.
  */
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-23  9:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21 10:08 [PATCH] rculist: unify documentation about missing list_empty_rcu() Julian Wiedmann
2021-05-21 17:56 ` Paul E. McKenney
2021-05-23  9:40   ` Julian Wiedmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®