summaryrefslogtreecommitdiff
path: root/include/linux/llist.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-08-29 16:03:13 +0300
committerIngo Molnar <mingo@kernel.org>2020-10-12 19:27:27 +0300
commit476c5818c37a7828d558f34ae01f0c32f8bfadde (patch)
treeda43e47fe5e7119c91b2ad5979720703fb161c59 /include/linux/llist.h
parentbcb53209be5cb32d485507452edda19b78f31d84 (diff)
downloadlinux-476c5818c37a7828d558f34ae01f0c32f8bfadde.tar.xz
llist: Add nonatomic __llist_add() and __llist_dell_all()
We'll use these in the new, lockless kretprobes code. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/159870619318.1229682.13027387548510028721.stgit@devnote2
Diffstat (limited to 'include/linux/llist.h')
-rw-r--r--include/linux/llist.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/llist.h b/include/linux/llist.h
index 2e9c7215882b..24f207b0190b 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -197,6 +197,16 @@ static inline struct llist_node *llist_next(struct llist_node *node)
extern bool llist_add_batch(struct llist_node *new_first,
struct llist_node *new_last,
struct llist_head *head);
+
+static inline bool __llist_add_batch(struct llist_node *new_first,
+ struct llist_node *new_last,
+ struct llist_head *head)
+{
+ new_last->next = head->first;
+ head->first = new_first;
+ return new_last->next == NULL;
+}
+
/**
* llist_add - add a new entry
* @new: new entry to be added
@@ -209,6 +219,11 @@ static inline bool llist_add(struct llist_node *new, struct llist_head *head)
return llist_add_batch(new, new, head);
}
+static inline bool __llist_add(struct llist_node *new, struct llist_head *head)
+{
+ return __llist_add_batch(new, new, head);
+}
+
/**
* llist_del_all - delete all entries from lock-less list
* @head: the head of lock-less list to delete all entries
@@ -222,6 +237,14 @@ static inline struct llist_node *llist_del_all(struct llist_head *head)
return xchg(&head->first, NULL);
}
+static inline struct llist_node *__llist_del_all(struct llist_head *head)
+{
+ struct llist_node *first = head->first;
+
+ head->first = NULL;
+ return first;
+}
+
extern struct llist_node *llist_del_first(struct llist_head *head);
struct llist_node *llist_reverse_order(struct llist_node *head);