summaryrefslogtreecommitdiff
path: root/include/linux/list.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-12-29 05:52:48 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2003-12-29 05:52:48 -0800
commit3182fe922bfe643b496950feb9e037d237125954 (patch)
tree8db6759df50b6ac8a04a09e3c699718f1c026635 /include/linux/list.h
parentc13bb4092eaad8ab8aeee575d97dafa8dab0c915 (diff)
[PATCH] list_empty_careful() documentation.
From: Ingo Molnar <mingo@elte.hu> I'd also suggest the following patch below, to clarify the use of unsynchronized list_empty(). list_empty_careful() can only be safe in the very specific case of "one-shot" list entries which might be removed by another CPU. (but nothing else can happen to them and this is their only final state.) list_empty_careful() is otherwise completely unsynchronized on both the compiler and CPU level and is not 'SMP safe' in any way.
Diffstat (limited to 'include/linux/list.h')
-rw-r--r--include/linux/list.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index 0835011b0ffb..9a5df31af22e 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -212,6 +212,12 @@ static inline int list_empty(const struct list_head *head)
* list_empty_careful - tests whether a list is
* empty _and_ checks that no other CPU might be
* in the process of still modifying either member
+ *
+ * NOTE: using list_empty_careful() without synchronization
+ * can only be safe if the only activity that can happen
+ * to the list entry is list_del_init(). Eg. it cannot be used
+ * if another CPU could re-list_add() it.
+ *
* @head: the list to test.
*/
static inline int list_empty_careful(const struct list_head *head)