* [PATCH] xenpaging: removed hard-coded 4 KiB page size, now calculates page size with sysconf
@ 2013-10-02 23:22 Gage Eads
2013-10-14 14:33 ` Ian Jackson
0 siblings, 1 reply; 2+ messages in thread
From: Gage Eads @ 2013-10-02 23:22 UTC (permalink / raw)
To: xen-devel; +Cc: ian.jackson, ian.campbell, Gage Eads, stefano.stabellini
Signed-off-by: Gage Eads <geads@eecs.berkeley.edu>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xenpaging: removed hard-coded 4 KiB page size, now calculates page size with sysconf
2013-10-02 23:22 [PATCH] xenpaging: removed hard-coded 4 KiB page size, now calculates page size with sysconf Gage Eads
@ 2013-10-14 14:33 ` Ian Jackson
0 siblings, 0 replies; 2+ messages in thread
From: Ian Jackson @ 2013-10-14 14:33 UTC (permalink / raw)
To: Gage Eads; +Cc: stefano.stabellini, ian.campbell, xen-devel
Gage Eads writes ("[PATCH] xenpaging: removed hard-coded 4 KiB page size, now calculates page size with sysconf"):
> Signed-off-by: Gage Eads <geads@eecs.berkeley.edu>
Is sysconf really the right place to get this from ?
Surely what is relevant is the Xen page size, which is available from
one of the Xen headers.
Ian.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-14 14:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02 23:22 [PATCH] xenpaging: removed hard-coded 4 KiB page size, now calculates page size with sysconf Gage Eads
2013-10-14 14:33 ` Ian Jackson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).