[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] waitqueue: Implement wake_up_{nr, one, all}.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1322252831 0
# Node ID 2a81ce2b2b9374adc051768fcf940d161ecc34dd
# Parent  96bbdc894224821fbc14a33e93b55688920c7fd2
waitqueue: Implement wake_up_{nr,one,all}.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 96bbdc894224 -r 2a81ce2b2b93 xen/common/wait.c
--- a/xen/common/wait.c Fri Nov 25 15:48:03 2011 +0000
+++ b/xen/common/wait.c Fri Nov 25 20:27:11 2011 +0000
@@ -87,13 +87,13 @@
     INIT_LIST_HEAD(&wq->list);
 }
 
-void wake_up(struct waitqueue_head *wq)
+void wake_up_nr(struct waitqueue_head *wq, unsigned int nr)
 {
     struct waitqueue_vcpu *wqv;
 
     spin_lock(&wq->lock);
 
-    while ( !list_empty(&wq->list) )
+    while ( !list_empty(&wq->list) && nr-- )
     {
         wqv = list_entry(wq->list.next, struct waitqueue_vcpu, list);
         list_del_init(&wqv->list);
@@ -103,6 +103,16 @@
     spin_unlock(&wq->lock);
 }
 
+void wake_up_one(struct waitqueue_head *wq)
+{
+    wake_up_nr(wq, 1);
+}
+
+void wake_up_all(struct waitqueue_head *wq)
+{
+    wake_up_nr(wq, UINT_MAX);
+}
+
 #ifdef CONFIG_X86
 
 static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
diff -r 96bbdc894224 -r 2a81ce2b2b93 xen/include/xen/wait.h
--- a/xen/include/xen/wait.h    Fri Nov 25 15:48:03 2011 +0000
+++ b/xen/include/xen/wait.h    Fri Nov 25 20:27:11 2011 +0000
@@ -28,8 +28,10 @@
 /* Dynamically initialise a waitqueue. */
 void init_waitqueue_head(struct waitqueue_head *wq);
 
-/* Wake all VCPUs waiting on specified waitqueue. */
-void wake_up(struct waitqueue_head *wq);
+/* Wake VCPU(s) waiting on specified waitqueue. */
+void wake_up_nr(struct waitqueue_head *wq, unsigned int nr);
+void wake_up_one(struct waitqueue_head *wq);
+void wake_up_all(struct waitqueue_head *wq);
 
 /* Wait on specified waitqueue until @condition is true. */
 #define wait_event(wq, condition)               \

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.