* @new_first: first entry in batch to be added
* @new_last: last entry in batch to be added
* @head: the head for your lock-less list
+ *
+ * Return whether list is empty before adding.
*/
-void llist_add_batch(struct llist_node *new_first, struct llist_node *new_last,
+bool llist_add_batch(struct llist_node *new_first, struct llist_node *new_last,
struct llist_head *head)
{
struct llist_node *entry, *old_entry;
entry = cmpxchg(&head->first, old_entry, new_first);
if (entry == old_entry)
break;
- cpu_relax();
}
+
+ return old_entry == NULL;
}
EXPORT_SYMBOL_GPL(llist_add_batch);
entry = cmpxchg(&head->first, old_entry, next);
if (entry == old_entry)
break;
- cpu_relax();
}
return entry;