diff options
author | Keir Fraser <keir@xen.org> | 2010-11-26 14:20:39 +0000 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2010-11-26 14:20:39 +0000 |
commit | cbf6a23dab0c7eba0b1348c87978b3725ea07df1 (patch) | |
tree | 4485fbe512d2b968581615e7cf6c962c90e5a6b3 /tools/xenpaging | |
parent | 16e8ccb10c22e49fb4dc803509c0937d2ac5a864 (diff) | |
download | xen-cbf6a23dab0c7eba0b1348c87978b3725ea07df1.tar.gz xen-cbf6a23dab0c7eba0b1348c87978b3725ea07df1.tar.bz2 xen-cbf6a23dab0c7eba0b1348c87978b3725ea07df1.zip |
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@aepfle.de>
Diffstat (limited to 'tools/xenpaging')
-rw-r--r-- | tools/xenpaging/xenpaging.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c index dd346db9a6..0a2fe2cf7c 100644 --- a/tools/xenpaging/xenpaging.c +++ b/tools/xenpaging/xenpaging.c @@ -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)); @@ -543,6 +541,13 @@ int main(int argc, char *argv[]) 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; act.sa_flags = 0; |