aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenpaging/xenpaging.c
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2011-11-20 17:02:50 +0100
committerOlaf Hering <olaf@aepfle.de>2011-11-20 17:02:50 +0100
commitc9e6b36d433e949e7e18b90b02db8449f84a0b68 (patch)
tree0303f9bbe473039c61b98bb8ca53560ad83ebdd4 /tools/xenpaging/xenpaging.c
parent6ca25a68ea914dd9c53d837db6d2f54ee823ca4d (diff)
downloadxen-c9e6b36d433e949e7e18b90b02db8449f84a0b68.tar.gz
xen-c9e6b36d433e949e7e18b90b02db8449f84a0b68.tar.bz2
xen-c9e6b36d433e949e7e18b90b02db8449f84a0b68.zip
xenpaging: improve policy mru list handling
Without this change it is not possible to page-out all guest pages, then trigger a page-in for all pages, and then page-out everything once again. All pages in the mru list can not be paged out because they remain active in the internal bitmap of paged pages. Use the mru list only if the number of paged-out pages is larger than the mru list. If the number is smaller, start to clear the mru list. In case the number of paged-out pages drops to zero the mru list and the internal bitmap will be empty as well. Also add a new interface for dropped pages. If a gfn was dropped there is no need to adjust the mru list because dropping a page is not usage of a page. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/xenpaging/xenpaging.c')
-rw-r--r--tools/xenpaging/xenpaging.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c
index f6cd05f700..8f9f52d1e0 100644
--- a/tools/xenpaging/xenpaging.c
+++ b/tools/xenpaging/xenpaging.c
@@ -615,7 +615,14 @@ static int xenpaging_resume_page(xenpaging_t *paging, mem_event_response_t *rsp,
/* Notify policy of page being paged in */
if ( notify_policy )
{
- policy_notify_paged_in(rsp->gfn);
+ /*
+ * Do not add gfn to mru list if the target is lower than mru size.
+ * This allows page-out of these gfns if the target grows again.
+ */
+ if (paging->num_paged_out > paging->policy_mru_size)
+ policy_notify_paged_in(rsp->gfn);
+ else
+ policy_notify_paged_in_nomru(rsp->gfn);
/* Record number of resumed pages */
paging->num_paged_out--;
@@ -869,7 +876,7 @@ int main(int argc, char *argv[])
{
DPRINTF("drop_page ^ gfn %"PRIx64" pageslot %d\n", req.gfn, i);
/* Notify policy of page being dropped */
- policy_notify_paged_in(req.gfn);
+ policy_notify_dropped(req.gfn);
}
else
{