aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHuang Ying <ying.huang@intel.com>2011-09-08 02:00:45 -0400
committerIngo Molnar <mingo@elte.hu>2011-10-04 06:43:44 -0400
commit781f7fd916fc77a862e20063ed3aeedf173234f9 (patch)
tree86d6e89060c765cbab65b7c3e77884d3e7c17e70 /lib
parenta3127336b71f6833d1483c856dce91fe558dc3a9 (diff)
llist: Return whether list is empty before adding in llist_add()
Extend the llist_add*() functions to return a success indicator, this allows us in the scheduler code to send an IPI if the queue was empty. ( There's no effect on existing users, because the list_add_xxx() functions are inline, thus this will be optimized out by the compiler if not used by callers. ) Signed-off-by: Huang Ying <ying.huang@intel.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1315461646-1379-5-git-send-email-ying.huang@intel.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'lib')
-rw-r--r--lib/llist.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/llist.c b/lib/llist.c
index 6c69f1d14c4b..878985c4d19d 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -34,8 +34,10 @@
34 * @new_first: first entry in batch to be added 34 * @new_first: first entry in batch to be added
35 * @new_last: last entry in batch to be added 35 * @new_last: last entry in batch to be added
36 * @head: the head for your lock-less list 36 * @head: the head for your lock-less list
37 *
38 * Return whether list is empty before adding.
37 */ 39 */
38void llist_add_batch(struct llist_node *new_first, struct llist_node *new_last, 40bool llist_add_batch(struct llist_node *new_first, struct llist_node *new_last,
39 struct llist_head *head) 41 struct llist_head *head)
40{ 42{
41 struct llist_node *entry, *old_entry; 43 struct llist_node *entry, *old_entry;
@@ -49,6 +51,8 @@ void llist_add_batch(struct llist_node *new_first, struct llist_node *new_last,
49 break; 51 break;
50 cpu_relax(); 52 cpu_relax();
51 } 53 }
54
55 return old_entry == NULL;
52} 56}
53EXPORT_SYMBOL_GPL(llist_add_batch); 57EXPORT_SYMBOL_GPL(llist_add_batch);
54 58