]> xenbits.xensource.com Git - people/pauldu/xenbus.git/commitdiff
Reduce priority of suspend thread
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 19 Jul 2016 13:13:51 +0000 (14:13 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 19 Jul 2016 13:13:51 +0000 (14:13 +0100)
In cycles of repeated suspend/resume attempt to make sure other threads
get to run by:

a) Dropping the priority of the suspend thread as low as possible.
b) Deliberately waiting for DPSc on other CPUs to complete before
   checking xenstore again.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xenbus/fdo.c

index da5cdcc57e04bda0e61ca23eaef3846c86445ed8..ce4d4ac1e3c1b4601c6fbf59887e3ffe50b65ac6 100644 (file)
@@ -1462,6 +1462,9 @@ FdoSuspend(
     Affinity.Mask = (KAFFINITY)1;
     KeSetSystemGroupAffinityThread(&Affinity, NULL);
 
+    (VOID) KeSetPriorityThread(KeGetCurrentThread(),
+                               LOW_PRIORITY);
+
     Event = ThreadGetEvent(Self);
 
     for (;;) {
@@ -1522,6 +1525,8 @@ FdoSuspend(
 
         __FdoSuspendClearActive(Fdo);
 
+        KeFlushQueuedDpcs();
+
 loop:
         KeSetEvent(&Fdo->SuspendEvent, IO_NO_INCREMENT, FALSE);
     }