Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269165
b: refs/heads/master
c: a312733
h: refs/heads/master
i:
  269163: f923faa
v: v3
  • Loading branch information
Huang Ying authored and Ingo Molnar committed Oct 4, 2011
1 parent a126c53 commit a0f503f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2c30245c65e8ebc3080b75ce65572ab8140bad0b
refs/heads/master: a3127336b71f6833d1483c856dce91fe558dc3a9
7 changes: 5 additions & 2 deletions trunk/include/linux/llist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/**
Expand Down
14 changes: 10 additions & 4 deletions trunk/lib/llist.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ void llist_add_batch(struct llist_node *new_first, struct llist_node *new_last,
struct llist_node *entry, *old_entry;

entry = head->first;
do {
for (;;) {
old_entry = entry;
new_last->next = entry;
entry = cmpxchg(&head->first, old_entry, new_first);
if (entry == old_entry)
break;
cpu_relax();
} while ((entry = cmpxchg(&head->first, old_entry, new_first)) != old_entry);
}
}
EXPORT_SYMBOL_GPL(llist_add_batch);

Expand All @@ -68,13 +71,16 @@ struct llist_node *llist_del_first(struct llist_head *head)
struct llist_node *entry, *old_entry, *next;

entry = head->first;
do {
for (;;) {
if (entry == NULL)
return NULL;
old_entry = entry;
next = entry->next;
entry = cmpxchg(&head->first, old_entry, next);
if (entry == old_entry)
break;
cpu_relax();
} while ((entry = cmpxchg(&head->first, old_entry, next)) != old_entry);
}

return entry;
}
Expand Down

0 comments on commit a0f503f

Please sign in to comment.