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

[Xen-changelog] [xen-unstable] xenpaging: allow negative num_pages and limit num_pages



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1290781239 0
# Node ID 1793318b35e65e055586d4d11622f9c9d4221d36
# Parent  7d2c013727d756e5c50726d9d55f108b006197dd
xenpaging: allow negative num_pages and limit num_pages

Simplify paging size argument. If a negative number is specified, it
means the entire guest memory should be paged out. This is useful for
debugging. Also limit num_pages to the guests max_pages.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
---
 tools/xenpaging/xenpaging.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff -r 7d2c013727d7 -r 1793318b35e6 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c       Fri Nov 26 14:20:10 2010 +0000
+++ b/tools/xenpaging/xenpaging.c       Fri Nov 26 14:20:39 2010 +0000
@@ -521,8 +521,6 @@ int main(int argc, char *argv[])
     domain_id = atoi(argv[1]);
     num_pages = atoi(argv[2]);
 
-    victims = calloc(num_pages, sizeof(xenpaging_victim_t));
-
     /* Seed random-number generator */
     srand(time(NULL));
 
@@ -542,6 +540,13 @@ int main(int argc, char *argv[])
         perror("failed to open file");
         return 2;
     }
+
+    if ( num_pages < 0 || num_pages > paging->domain_info->max_pages )
+    {
+        num_pages = paging->domain_info->max_pages;
+        DPRINTF("setting num_pages to %d\n", num_pages);
+    }
+    victims = calloc(num_pages, sizeof(xenpaging_victim_t));
 
     /* ensure that if we get a signal, we'll do cleanup, then exit */
     act.sa_handler = close_handler;

_______________________________________________
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®.