xen/xenpaging.runtime_mru_size.patch
Charles Arnold 551c9a62bc - Update to Xen 4.0.2 rc2, changeset 21452
- Enable support for kernel decompression for gzip, bzip2, and LZMA 
  so that kernels compressed with any of these methods can be 
  launched. 

- update xenalyze, more 64bit fixes

- allocate xentrace buffer metadata based on requested tbuf_size
  xentrace.dynamic_sized_tbuf.patch

- fate#310510 - fix xenpaging
  xenpaging.runtime_mru_size.patch
  - specify policy mru size at runtime
  xenpaging.no_domain_id.patch
  - reduce memory usage in pager

- bnc#625394 - set vif mtu from bridge mtu if kernel supports it
  vif-bridge.mtu.patch

- fate#310510 - fix xenpaging
  xenpaging.autostart_delay.patch
  - decouple create/destroycreateXenPaging from _create/_removeDevices
  - change xenpaging variable from int to str
  - init xenpaging variable to 0 if xenpaging is not in config file
    to avoid string None coming from sxp file

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=97
2011-02-14 21:35:06 +00:00

108 lines
3.3 KiB
Diff

Subject: 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.
(xen-unstable changeset: 22700:f87b1c194eb8)
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/xenpaging/policy_default.c | 21 +++++++++++++++++----
tools/xenpaging/xenpaging.c | 8 ++++++++
tools/xenpaging/xenpaging.h | 1 +
3 files changed, 26 insertions(+), 4 deletions(-)
Index: xen-4.0.2-testing/tools/xenpaging/policy_default.c
===================================================================
--- xen-4.0.2-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.0.2-testing/tools/xenpaging/policy_default.c
@@ -29,7 +29,8 @@
#define MRU_SIZE (1024 * 16)
-static unsigned long mru[MRU_SIZE];
+static unsigned long *mru;
+static unsigned int mru_size;
static unsigned int i_mru;
static unsigned long *bitmap;
static unsigned long *unconsumed;
@@ -56,8 +57,20 @@ int policy_init(xenpaging_t *paging)
bitmap_size = paging->bitmap_size;
max_pages = paging->domain_info->max_pages;
+ if ( paging->policy_mru_size > 0 )
+ mru_size = paging->policy_mru_size;
+ else
+ mru_size = MRU_SIZE;
+
+ mru = malloc(sizeof(*mru) * mru_size);
+ if ( mru == NULL )
+ {
+ rc = -ENOMEM;
+ goto out;
+ }
+
/* Initialise MRU list of paged in pages */
- for ( i = 0; i < MRU_SIZE; i++ )
+ for ( i = 0; i < mru_size; i++ )
mru[i] = INVALID_MFN;
/* Don't page out first 16MB */
@@ -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++;
}
Index: xen-4.0.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.0.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.0.2-testing/tools/xenpaging/xenpaging.c
@@ -80,6 +80,7 @@ static void *init_page(void)
xenpaging_t *xenpaging_init(domid_t domain_id)
{
xenpaging_t *paging;
+ char *p;
int rc;
DPRINTF("xenpaging init\n");
@@ -96,6 +97,13 @@ xenpaging_t *xenpaging_init(domid_t doma
goto err;
}
+ 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);
+ }
+
/* Set domain id */
paging->mem_event.domain_id = domain_id;
Index: xen-4.0.2-testing/tools/xenpaging/xenpaging.h
===================================================================
--- xen-4.0.2-testing.orig/tools/xenpaging/xenpaging.h
+++ xen-4.0.2-testing/tools/xenpaging/xenpaging.h
@@ -37,6 +37,7 @@
typedef struct xenpaging {
int xc_handle;
+ int policy_mru_size;
xc_platform_info_t *platform_info;
xc_domaininfo_t *domain_info;