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

[Xen-devel] [PATCH] xenpaging: removed hard-coded 4 KiB page size, now calculates page size with sysconf



Signed-off-by: Gage Eads <geads@xxxxxxxxxxxxxxxxx>
---
 tools/xenpaging/xenpaging.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c
index 5ef2f09..8467818 100644
--- a/tools/xenpaging/xenpaging.c
+++ b/tools/xenpaging/xenpaging.c
@@ -44,6 +44,7 @@ static char *dom_path;
 static char watch_token[16];
 static char *filename;
 static int interrupted;
+static int page_size_KiB;
 
 static void unlink_pagefile(void)
 {
@@ -129,7 +130,7 @@ static int xenpaging_wait_for_event_or_timeout(struct 
xenpaging *paging)
                     if ( ret > 0 )
                     {
                         /* KiB to pages */
-                        target_tot_pages >>= 2;
+                        target_tot_pages /= page_size_KiB;
                         if ( target_tot_pages < 0 || target_tot_pages > 
paging->max_pages )
                             target_tot_pages = paging->max_pages;
                         paging->target_tot_pages = target_tot_pages;
@@ -238,7 +239,7 @@ static int xenpaging_getopts(struct xenpaging *paging, int 
argc, char *argv[])
             break;
         case 'm':
             /* KiB to pages */
-            paging->max_pages = atoi(optarg) >> 2;
+            paging->max_pages = atoi(optarg) / page_size_KiB;
             break;
         case 'r':
             paging->policy_mru_size = atoi(optarg);
@@ -288,6 +289,8 @@ static struct xenpaging *xenpaging_init(int argc, char 
*argv[])
     if ( !paging )
         goto err;
 
+    int page_size_KiB = sysconf(_SC_PAGESIZE)/1024;
+
     /* Get cmdline options and domain_id */
     if ( xenpaging_getopts(paging, argc, argv) )
         goto err;
-- 
1.8.1.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.