summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMadhuparna Bhowmik <madhuparnabhowmik04@gmail.com>2019-12-09 10:50:43 +0300
committerPaul E. McKenney <paulmck@kernel.org>2020-01-11 01:00:58 +0300
commitafa47fdfa29ffd3324e7b89551d1a6e54ccc042b (patch)
treedeca7e5f58de7f593899f13f9d036d27b15f9dbe
parent459b5287066f53c4b91569c070780a540de90b85 (diff)
downloadlinux-afa47fdfa29ffd3324e7b89551d1a6e54ccc042b.tar.xz
rculist.h: Add list_tail_rcu()
This patch adds the macro list_tail_rcu() and documents it. Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com> [ paulmck: Reword a bit. ] Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
-rw-r--r--include/linux/rculist.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 4b7ae1bf50b3..9f313e4999fe 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -40,6 +40,16 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list)
*/
#define list_next_rcu(list) (*((struct list_head __rcu **)(&(list)->next)))
+/**
+ * list_tail_rcu - returns the prev pointer of the head of the list
+ * @head: the head of the list
+ *
+ * Note: This should only be used with the list header, and even then
+ * only if list_del() and similar primitives are not also used on the
+ * list header.
+ */
+#define list_tail_rcu(head) (*((struct list_head __rcu **)(&(head)->prev)))
+
/*
* Check during list traversal that we are within an RCU reader
*/