[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210521100829.257385-1-jwi@linux.ibm.com>
Date: Fri, 21 May 2021 12:08:29 +0200
From: Julian Wiedmann <jwi@...ux.ibm.com>
To: "Paul E. McKenney" <paulmck@...nel.org>,
Josh Triplett <josh@...htriplett.org>
Cc: Julian Wiedmann <jwi@...ux.ibm.com>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Joel Fernandes <joel@...lfernandes.org>, rcu@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] rculist: unify documentation about missing list_empty_rcu()
We have two separate sections that talk about why list_empty_rcu()
is not needed, consolidate them.
Signed-off-by: Julian Wiedmann <jwi@...ux.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
Powered by blists - more mailing lists