WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xenpaging: specify policy mru_size at run

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xenpaging: specify policy mru_size at runtime
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Jan 2011 07:59:27 -0800
Delivery-date: Mon, 17 Jan 2011 08:12:05 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1294741925 0
# Node ID f87b1c194eb87d4f9a0d7d075a68911e402629ad
# Parent  f84ae053b7daf396c238dd61592d78dea97b1ff4
xenpaging: specify policy mru_size at runtime

The environment variable XENPAGING_POLICY_MRU_SIZE will change the
mru_size in the policy at runtime.  Specifying the mru_size at runtime
allows the admin to keep more pages in memory so guests can make more
progress.  Its also good for development to reduce the value to put
more pressure on the paging related code paths.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
---
 tools/xenpaging/policy_default.c |   23 ++++++++++++++++++-----
 tools/xenpaging/xenpaging.c      |    8 ++++++++
 tools/xenpaging/xenpaging.h      |    1 +
 3 files changed, 27 insertions(+), 5 deletions(-)

diff -r f84ae053b7da -r f87b1c194eb8 tools/xenpaging/policy_default.c
--- a/tools/xenpaging/policy_default.c  Tue Jan 11 10:31:33 2011 +0000
+++ b/tools/xenpaging/policy_default.c  Tue Jan 11 10:32:05 2011 +0000
@@ -26,11 +26,12 @@
 #include "policy.h"
 
 
-#define MRU_SIZE (1024 * 16)
+#define DEFAULT_MRU_SIZE (1024 * 16)
 
 
-static unsigned long mru[MRU_SIZE];
+static unsigned long *mru;
 static unsigned int i_mru;
+static unsigned int mru_size;
 static unsigned long *bitmap;
 static unsigned long *unconsumed;
 static unsigned long current_gfn;
@@ -57,7 +58,19 @@ int policy_init(xenpaging_t *paging)
     max_pages = paging->domain_info->max_pages;
 
     /* Initialise MRU list of paged in pages */
-    for ( i = 0; i < MRU_SIZE; i++ )
+    if ( paging->policy_mru_size > 0 )
+        mru_size = paging->policy_mru_size;
+    else
+        mru_size = DEFAULT_MRU_SIZE;
+
+    mru = malloc(sizeof(*mru) * mru_size);
+    if ( mru == NULL )
+    {
+        rc = -ENOMEM;
+        goto out;
+    }
+
+    for ( i = 0; i < mru_size; i++ )
         mru[i] = INVALID_MFN;
 
     /* Don't page out page 0 */
@@ -100,12 +113,12 @@ void policy_notify_paged_out(unsigned lo
 
 void policy_notify_paged_in(unsigned long gfn)
 {
-    unsigned long old_gfn = mru[i_mru & (MRU_SIZE - 1)];
+    unsigned long old_gfn = mru[i_mru & (mru_size - 1)];
 
     if ( old_gfn != INVALID_MFN )
         clear_bit(old_gfn, bitmap);
     
-    mru[i_mru & (MRU_SIZE - 1)] = gfn;
+    mru[i_mru & (mru_size - 1)] = gfn;
     i_mru++;
 }
 
diff -r f84ae053b7da -r f87b1c194eb8 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c       Tue Jan 11 10:31:33 2011 +0000
+++ b/tools/xenpaging/xenpaging.c       Tue Jan 11 10:32:05 2011 +0000
@@ -78,6 +78,7 @@ xenpaging_t *xenpaging_init(domid_t doma
     xenpaging_t *paging;
     xc_interface *xch;
     xentoollog_logger *dbg = NULL;
+    char *p;
     int rc;
 
     if ( getenv("XENPAGING_DEBUG") )
@@ -91,6 +92,13 @@ xenpaging_t *xenpaging_init(domid_t doma
     /* Allocate memory */
     paging = malloc(sizeof(xenpaging_t));
     memset(paging, 0, sizeof(xenpaging_t));
+
+    p = getenv("XENPAGING_POLICY_MRU_SIZE");
+    if ( p && *p )
+    {
+         paging->policy_mru_size = atoi(p);
+         DPRINTF("Setting policy mru_size to %d\n", paging->policy_mru_size);
+    }
 
     /* Open connection to xen */
     paging->xc_handle = xch;
diff -r f84ae053b7da -r f87b1c194eb8 tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h       Tue Jan 11 10:31:33 2011 +0000
+++ b/tools/xenpaging/xenpaging.h       Tue Jan 11 10:32:05 2011 +0000
@@ -45,6 +45,7 @@ typedef struct xenpaging {
     unsigned long *bitmap;
 
     mem_event_t mem_event;
+    int policy_mru_size;
 } xenpaging_t;
 
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xenpaging: specify policy mru_size at runtime, Xen patchbot-unstable <=