summaryrefslogtreecommitdiffstats
path: root/include/linux/llist.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/llist.h')
-rw-r--r--include/linux/llist.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/llist.h b/include/linux/llist.h
index 65fca1cbf51..ca91875286b 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -148,11 +148,14 @@ static inline void llist_add(struct llist_node *new, struct llist_head *head)
struct llist_node *entry, *old_entry;
entry = head->first;
- do {
+ for (;;) {
old_entry = entry;
new->next = entry;
+ entry = cmpxchg(&head->first, old_entry, new);
+ if (entry == old_entry)
+ break;
cpu_relax();
- } while ((entry = cmpxchg(&head->first, old_entry, new)) != old_entry);
+ }
}
/**