diff options
Diffstat (limited to 'tools/xenpaging')
-rw-r--r-- | tools/xenpaging/policy_default.c | 1 | ||||
-rw-r--r-- | tools/xenpaging/xenpaging.c | 15 | ||||
-rw-r--r-- | tools/xenpaging/xenpaging.h | 1 |
3 files changed, 16 insertions, 1 deletions
diff --git a/tools/xenpaging/policy_default.c b/tools/xenpaging/policy_default.c index 596afc7d9a..7563720092 100644 --- a/tools/xenpaging/policy_default.c +++ b/tools/xenpaging/policy_default.c @@ -90,6 +90,7 @@ unsigned long policy_choose_victim(struct xenpaging *paging) /* 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 --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c index 8d07ef0463..e25614063a 100644 --- a/tools/xenpaging/xenpaging.c +++ b/tools/xenpaging/xenpaging.c @@ -84,6 +84,7 @@ static int xenpaging_wait_for_event_or_timeout(struct xenpaging *paging) 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 @@ static int xenpaging_wait_for_event_or_timeout(struct xenpaging *paging) 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 @@ static int xenpaging_wait_for_event_or_timeout(struct xenpaging *paging) 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 @@ int main(int argc, char *argv[]) } /* 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 @@ int main(int argc, char *argv[]) } 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 --git a/tools/xenpaging/xenpaging.h b/tools/xenpaging/xenpaging.h index 545f2d3626..abc9f89ec4 100644 --- a/tools/xenpaging/xenpaging.h +++ b/tools/xenpaging/xenpaging.h @@ -55,6 +55,7 @@ struct xenpaging { 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]; }; |