Olaf Hering
ee2be8156e
This change reverses the task of xenpaging. Before this change a fixed number of pages was paged out. With this change the guest will not have access to more than the given number of pages at the same time. The xenpaging= config option is replaced by actmem= A new xm mem-swap-target is added. The xenpaging binary is moved to /usr/lib/xen/bin/ xenpaging.HVMCOPY_gfn_paged_out.patch xenpaging.XEN_PAGING_DIR.patch xenpaging.add_evict_pages.patch xenpaging.bitmap_clear.patch xenpaging.cmdline-interface.patch xenpaging.encapsulate_domain_info.patch xenpaging.file_op-return-code.patch xenpaging.guest-memusage.patch xenpaging.install-to-libexec.patch xenpaging.low_target_policy_nomru.patch xenpaging.main-loop-exit-handling.patch xenpaging.misleading-comment.patch xenpaging.page_in-munmap-size.patch xenpaging.print-gfn.patch xenpaging.record-numer-paged-out-pages.patch xenpaging.reset-uncomsumed.patch xenpaging.stale-comments.patch xenpaging.target-tot_pages.patch xenpaging.use-PERROR.patch xenpaging.watch-target-tot_pages.patch xenpaging.watch_event-DPRINTF.patch xenpaging.xc_interface_open-comment.patch - xen.spec: update filelist package /usr/lib*/xen with wildcard to pickup new files remove duplicate /usr/sbin/xen-list from filelist OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=157
141 lines
4.7 KiB
Diff
141 lines
4.7 KiB
Diff
# HG changeset patch
|
|
# Parent f665912bc70e0b12e194cf1dd1d37bd22b29c54f
|
|
xenpaging: remove xc_dominfo_t from paging_t
|
|
|
|
Remove xc_dominfo_t from paging_t, record only max_pages.
|
|
This value is used to setup internal data structures.
|
|
|
|
Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
|
|
|
---
|
|
tools/xenpaging/policy_default.c | 8 ++++----
|
|
tools/xenpaging/xenpaging.c | 27 +++++++++++----------------
|
|
tools/xenpaging/xenpaging.h | 4 ++--
|
|
3 files changed, 17 insertions(+), 22 deletions(-)
|
|
|
|
Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c
|
|
===================================================================
|
|
--- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c
|
|
+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c
|
|
@@ -41,17 +41,17 @@ int policy_init(xenpaging_t *paging)
|
|
int i;
|
|
int rc = -ENOMEM;
|
|
|
|
+ max_pages = paging->max_pages;
|
|
+
|
|
/* Allocate bitmap for pages not to page out */
|
|
- bitmap = bitmap_alloc(paging->domain_info->max_pages);
|
|
+ bitmap = bitmap_alloc(max_pages);
|
|
if ( !bitmap )
|
|
goto out;
|
|
/* Allocate bitmap to track unusable pages */
|
|
- unconsumed = bitmap_alloc(paging->domain_info->max_pages);
|
|
+ unconsumed = bitmap_alloc(max_pages);
|
|
if ( !unconsumed )
|
|
goto out;
|
|
|
|
- max_pages = paging->domain_info->max_pages;
|
|
-
|
|
/* Initialise MRU list of paged in pages */
|
|
if ( paging->policy_mru_size > 0 )
|
|
mru_size = paging->policy_mru_size;
|
|
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
|
|
===================================================================
|
|
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
|
|
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
|
|
@@ -164,6 +164,7 @@ static void *init_page(void)
|
|
static xenpaging_t *xenpaging_init(domid_t domain_id, int num_pages)
|
|
{
|
|
xenpaging_t *paging;
|
|
+ xc_domaininfo_t domain_info;
|
|
xc_interface *xch;
|
|
xentoollog_logger *dbg = NULL;
|
|
char *p;
|
|
@@ -275,34 +276,29 @@ static xenpaging_t *xenpaging_init(domid
|
|
|
|
paging->mem_event.port = rc;
|
|
|
|
- /* Get domaininfo */
|
|
- paging->domain_info = malloc(sizeof(xc_domaininfo_t));
|
|
- if ( paging->domain_info == NULL )
|
|
- {
|
|
- PERROR("Error allocating memory for domain info");
|
|
- goto err;
|
|
- }
|
|
-
|
|
rc = xc_domain_getinfolist(xch, paging->mem_event.domain_id, 1,
|
|
- paging->domain_info);
|
|
+ &domain_info);
|
|
if ( rc != 1 )
|
|
{
|
|
PERROR("Error getting domain info");
|
|
goto err;
|
|
}
|
|
|
|
+ /* Record number of max_pages */
|
|
+ paging->max_pages = domain_info.max_pages;
|
|
+
|
|
/* Allocate bitmap for tracking pages that have been paged out */
|
|
- paging->bitmap = bitmap_alloc(paging->domain_info->max_pages);
|
|
+ paging->bitmap = bitmap_alloc(paging->max_pages);
|
|
if ( !paging->bitmap )
|
|
{
|
|
PERROR("Error allocating bitmap");
|
|
goto err;
|
|
}
|
|
- DPRINTF("max_pages = %"PRIx64"\n", paging->domain_info->max_pages);
|
|
+ DPRINTF("max_pages = %d\n", paging->max_pages);
|
|
|
|
- if ( num_pages < 0 || num_pages > paging->domain_info->max_pages )
|
|
+ if ( num_pages < 0 || num_pages > paging->max_pages )
|
|
{
|
|
- num_pages = paging->domain_info->max_pages;
|
|
+ num_pages = paging->max_pages;
|
|
DPRINTF("setting num_pages to %d\n", num_pages);
|
|
}
|
|
paging->num_pages = num_pages;
|
|
@@ -337,7 +333,6 @@ static xenpaging_t *xenpaging_init(domid
|
|
}
|
|
|
|
free(paging->bitmap);
|
|
- free(paging->domain_info);
|
|
free(paging);
|
|
}
|
|
|
|
@@ -765,7 +760,7 @@ int main(int argc, char *argv[])
|
|
if ( interrupted == SIGTERM || interrupted == SIGINT )
|
|
{
|
|
int num = 0;
|
|
- for ( i = 0; i < paging->domain_info->max_pages; i++ )
|
|
+ for ( i = 0; i < paging->max_pages; i++ )
|
|
{
|
|
if ( test_bit(i, paging->bitmap) )
|
|
{
|
|
@@ -781,7 +776,7 @@ int main(int argc, char *argv[])
|
|
*/
|
|
if ( num )
|
|
page_in_trigger();
|
|
- else if ( i == paging->domain_info->max_pages )
|
|
+ else if ( i == paging->max_pages )
|
|
break;
|
|
}
|
|
else
|
|
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h
|
|
===================================================================
|
|
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h
|
|
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h
|
|
@@ -44,11 +44,11 @@ typedef struct xenpaging {
|
|
xc_interface *xc_handle;
|
|
struct xs_handle *xs_handle;
|
|
|
|
- xc_domaininfo_t *domain_info;
|
|
-
|
|
unsigned long *bitmap;
|
|
|
|
mem_event_t mem_event;
|
|
+ /* number of pages for which data structures were allocated */
|
|
+ int max_pages;
|
|
int num_pages;
|
|
int policy_mru_size;
|
|
unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
|