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

[Xen-changelog] [xen-unstable] xenpaging: no poll timeout while page-out is in progress



# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1329769124 -3600
# Node ID da01faa3e11eb5fe5d4a6ad2beee0c802020cfaa
# Parent  06cf45130725c021623f9c20b9d3ac2f925922f2
xenpaging: no poll timeout while page-out is in progress

The main loop calls xenpaging_wait_for_event_or_timeout() unconditionally
before doing any work. This function calls poll() with a timeout of 100ms. As
a result the page-out process is very slow due to the delay in poll().

Call poll() without timeout so that it returns immediately until the page-out
is done. Page-out is done when either the policy finds no more pages to
nominate or when the requested number of pages is reached.

The condition is cleared when a watch event arrives, so that processing the
new target is not delayed once again by poll().

v2:
- no poll timeout also when large number of evicts is pending

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 06cf45130725 -r da01faa3e11e tools/xenpaging/policy_default.c
--- a/tools/xenpaging/policy_default.c  Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/policy_default.c  Mon Feb 20 21:18:44 2012 +0100
@@ -90,6 +90,7 @@
         /* Could not nominate any gfn */
         if ( wrap == current_gfn )
         {
+            paging->use_poll_timeout = 1;
             /* Count wrap arounds */
             unconsumed_cleared++;
             /* Force retry every few seconds (depends on poll() timeout) */
diff -r 06cf45130725 -r da01faa3e11e tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c       Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c       Mon Feb 20 21:18:44 2012 +0100
@@ -84,6 +84,7 @@
     struct pollfd fd[2];
     int port;
     int rc;
+    int timeout;
 
     /* Wait for event channel and xenstore */
     fd[0].fd = xc_evtchn_fd(xce);
@@ -91,7 +92,9 @@
     fd[1].fd = xs_fileno(paging->xs_handle);
     fd[1].events = POLLIN | POLLERR;
 
-    rc = poll(fd, 2, 100);
+    /* No timeout while page-out is still in progress */
+    timeout = paging->use_poll_timeout ? 100 : 0;
+    rc = poll(fd, 2, timeout);
     if ( rc < 0 )
     {
         if (errno == EINTR)
@@ -133,6 +136,8 @@
                         if ( target_tot_pages < 0 || target_tot_pages > 
paging->max_pages )
                             target_tot_pages = paging->max_pages;
                         paging->target_tot_pages = target_tot_pages;
+                        /* Disable poll() delay while new target is not yet 
reached */
+                        paging->use_poll_timeout = 0;
                         DPRINTF("new target_tot_pages %d\n", target_tot_pages);
                     }
                     free(val);
@@ -970,7 +975,10 @@
             }
             /* Limit the number of evicts to be able to process page-in 
requests */
             if ( num > 42 )
+            {
+                paging->use_poll_timeout = 0;
                 num = 42;
+            }
             evict_pages(paging, fd, num);
         }
         /* Resume some pages if target not reached */
@@ -984,6 +992,11 @@
             }
             resume_pages(paging, num);
         }
+        /* Now target was reached, enable poll() timeout */
+        else
+        {
+            paging->use_poll_timeout = 1;
+        }
 
     }
     DPRINTF("xenpaging got signal %d\n", interrupted);
diff -r 06cf45130725 -r da01faa3e11e tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h       Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.h       Mon Feb 20 21:18:44 2012 +0100
@@ -55,6 +55,7 @@
     int num_paged_out;
     int target_tot_pages;
     int policy_mru_size;
+    int use_poll_timeout;
     int debug;
     unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
 };

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.