[QUESTION] llist: Comment releasing 'must delete' restriction before traversing
From: Byungchul Park
Date: Mon Jul 30 2018 - 20:31:57 EST
llist traversing can run without deletion in restrictive cases all
items are added but never deleted like a rculist traversing such as
list_for_each_entry_lockless. So add the comment.
Signed-off-by: Byungchul Park <byungchul.park@xxxxxxx>
---
include/linux/llist.h | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/include/linux/llist.h b/include/linux/llist.h
index 85abc29..d012d3e 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -32,8 +32,12 @@
* operation, with "-" being no lock needed, while "L" being lock is needed.
*
* The list entries deleted via llist_del_all can be traversed with
- * traversing function such as llist_for_each etc. But the list
- * entries can not be traversed safely before deleted from the list.
+ * traversing function such as llist_for_each etc. Normally the list
+ * entries cannot be traversed safely before deleted from the list
+ * except the cases items are added to the list but never deleted. In
+ * that restrictive cases the list may be safely traversed concurrently
+ * with llist_add.
+ *
* The order of deleted entries is from the newest to the oldest added
* one. If you want to traverse from the oldest to the newest, you
* must reverse the order by yourself before traversing.
@@ -116,7 +120,9 @@ static inline void init_llist_head(struct llist_head *list)
*
* In general, some entries of the lock-less list can be traversed
* safely only after being deleted from list, so start with an entry
- * instead of list head.
+ * instead of list head. But in restrictive cases items are added to
+ * the list but never deleted, the list may be safely traversed
+ * concurrently with llist_add.
*
* If being used on entries deleted from lock-less list directly, the
* traverse order is from the newest to the oldest added entry. If
@@ -135,7 +141,9 @@ static inline void init_llist_head(struct llist_head *list)
*
* In general, some entries of the lock-less list can be traversed
* safely only after being deleted from list, so start with an entry
- * instead of list head.
+ * instead of list head. But in restrictive cases items are added to
+ * the list but never deleted, the list may be safely traversed
+ * concurrently with llist_add.
*
* If being used on entries deleted from lock-less list directly, the
* traverse order is from the newest to the oldest added entry. If
@@ -153,7 +161,9 @@ static inline void init_llist_head(struct llist_head *list)
*
* In general, some entries of the lock-less list can be traversed
* safely only after being removed from list, so start with an entry
- * instead of list head.
+ * instead of list head. But in restrictive cases items are added to
+ * the list but never deleted, the list may be safely traversed
+ * concurrently with llist_add.
*
* If being used on entries deleted from lock-less list directly, the
* traverse order is from the newest to the oldest added entry. If
@@ -175,7 +185,9 @@ static inline void init_llist_head(struct llist_head *list)
*
* In general, some entries of the lock-less list can be traversed
* safely only after being removed from list, so start with an entry
- * instead of list head.
+ * instead of list head. But in restrictive cases items are added to
+ * the list but never deleted, the list may be safely traversed
+ * concurrently with llist_add.
*
* If being used on entries deleted from lock-less list directly, the
* traverse order is from the newest to the oldest added entry. If
--
1.9.1