Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Peter Zijlstra and committed by
Ingo Molnar
476c5818 bcb53209

+23 -6
-6
drivers/gpu/drm/i915/i915_request.c
··· 357 357 } while (i915_request_retire(tmp) && tmp != rq); 358 358 } 359 359 360 - static void __llist_add(struct llist_node *node, struct llist_head *head) 361 - { 362 - node->next = head->first; 363 - head->first = node; 364 - } 365 - 366 360 static struct i915_request * const * 367 361 __engine_active(struct intel_engine_cs *engine) 368 362 {
+23
include/linux/llist.h
··· 197 197 extern bool llist_add_batch(struct llist_node *new_first, 198 198 struct llist_node *new_last, 199 199 struct llist_head *head); 200 + 201 + static inline bool __llist_add_batch(struct llist_node *new_first, 202 + struct llist_node *new_last, 203 + struct llist_head *head) 204 + { 205 + new_last->next = head->first; 206 + head->first = new_first; 207 + return new_last->next == NULL; 208 + } 209 + 200 210 /** 201 211 * llist_add - add a new entry 202 212 * @new: new entry to be added ··· 217 207 static inline bool llist_add(struct llist_node *new, struct llist_head *head) 218 208 { 219 209 return llist_add_batch(new, new, head); 210 + } 211 + 212 + static inline bool __llist_add(struct llist_node *new, struct llist_head *head) 213 + { 214 + return __llist_add_batch(new, new, head); 220 215 } 221 216 222 217 /** ··· 235 220 static inline struct llist_node *llist_del_all(struct llist_head *head) 236 221 { 237 222 return xchg(&head->first, NULL); 223 + } 224 + 225 + static inline struct llist_node *__llist_del_all(struct llist_head *head) 226 + { 227 + struct llist_node *first = head->first; 228 + 229 + head->first = NULL; 230 + return first; 238 231 } 239 232 240 233 extern struct llist_node *llist_del_first(struct llist_head *head);