aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rculist.h
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2010-08-20 00:43:09 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2010-08-20 12:00:18 -0400
commit65e6bf484c497f02d47a0faae69ee398cd59cfda (patch)
tree644a86b779a196da7c050cde9de593c413e0cc1e /include/linux/rculist.h
parent80dcf60e6b97c7363971e7a0a788d8484d35f8a6 (diff)
rcu: add comment stating that list_empty() applies to RCU-protected lists
Because list_empty() does not dereference any RCU-protected pointers, and further does not pass such pointers to the caller (so that the caller does not dereference them either), it is safe to use list_empty() on RCU-protected lists. There is no need for a list_empty_rcu(). This commit adds a comment stating this explicitly. Requested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/rculist.h')
-rw-r--r--include/linux/rculist.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index c10b1050dbe6..f31ef61f1c65 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -10,6 +10,15 @@
10#include <linux/rcupdate.h> 10#include <linux/rcupdate.h>
11 11
12/* 12/*
13 * Why is there no list_empty_rcu()? Because list_empty() serves this
14 * purpose. The list_empty() function fetches the RCU-protected pointer
15 * and compares it to the address of the list head, but neither dereferences
16 * this pointer itself nor provides this pointer to the caller. Therefore,
17 * it is not necessary to use rcu_dereference(), so that list_empty() can
18 * be used anywhere you would want to use a list_empty_rcu().
19 */
20
21/*
13 * return the ->next pointer of a list_head in an rcu safe 22 * return the ->next pointer of a list_head in an rcu safe
14 * way, we must not access it directly 23 * way, we must not access it directly
15 */ 24 */