Commit 476c5818 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

llist: Add nonatomic __llist_add() and __llist_dell_all()

We'll use these in the new, lockless kretprobes code.
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/159870619318.1229682.13027387548510028721.stgit@devnote2
parent bcb53209
...@@ -357,12 +357,6 @@ void i915_request_retire_upto(struct i915_request *rq) ...@@ -357,12 +357,6 @@ void i915_request_retire_upto(struct i915_request *rq)
} while (i915_request_retire(tmp) && tmp != rq); } while (i915_request_retire(tmp) && tmp != rq);
} }
static void __llist_add(struct llist_node *node, struct llist_head *head)
{
node->next = head->first;
head->first = node;
}
static struct i915_request * const * static struct i915_request * const *
__engine_active(struct intel_engine_cs *engine) __engine_active(struct intel_engine_cs *engine)
{ {
......
...@@ -197,6 +197,16 @@ static inline struct llist_node *llist_next(struct llist_node *node) ...@@ -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, extern bool llist_add_batch(struct llist_node *new_first,
struct llist_node *new_last, struct llist_node *new_last,
struct llist_head *head); 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 * llist_add - add a new entry
* @new: new entry to be added * @new: new entry to be added
...@@ -209,6 +219,11 @@ static inline bool llist_add(struct llist_node *new, struct llist_head *head) ...@@ -209,6 +219,11 @@ static inline bool llist_add(struct llist_node *new, struct llist_head *head)
return llist_add_batch(new, new, 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 * llist_del_all - delete all entries from lock-less list
* @head: the head of lock-less list to delete all entries * @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) ...@@ -222,6 +237,14 @@ static inline struct llist_node *llist_del_all(struct llist_head *head)
return xchg(&head->first, NULL); 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); extern struct llist_node *llist_del_first(struct llist_head *head);
struct llist_node *llist_reverse_order(struct llist_node *head); struct llist_node *llist_reverse_order(struct llist_node *head);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment