# HG changeset patch
# User Olaf Hering <olafiaepfle.de>
# Date 1317071982 -3600
# Node ID 651aed73b39c4d1613e7b95c29953309b38f7cc2
# Parent fef59e4eaf8d6e52c21f7ae309fdebbbbb725d1d
xenpaging: track number of paged pages in struct domain
The toolstack should know how many pages are paged-out at a given point
in time so it could make smarter decisions about how many pages should
be paged or ballooned.
Add a new member to xen_domctl_getdomaininfo and bump interface version.
Use the new member in xc_dominfo_t.
The SONAME of libxc should be changed if this patch gets applied.
Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Tim Deegan <tim@xxxxxxx>
Committed-by: Tim Deegan <tim@xxxxxxx>
---
diff -r fef59e4eaf8d -r 651aed73b39c tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Mon Sep 26 22:10:21 2011 +0100
+++ b/tools/libxc/xc_domain.c Mon Sep 26 22:19:42 2011 +0100
@@ -235,6 +235,7 @@
info->ssidref = domctl.u.getdomaininfo.ssidref;
info->nr_pages = domctl.u.getdomaininfo.tot_pages;
info->nr_shared_pages = domctl.u.getdomaininfo.shr_pages;
+ info->nr_paged_pages = domctl.u.getdomaininfo.paged_pages;
info->max_memkb = domctl.u.getdomaininfo.max_pages << (PAGE_SHIFT-10);
info->shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
info->cpu_time = domctl.u.getdomaininfo.cpu_time;
diff -r fef59e4eaf8d -r 651aed73b39c tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Mon Sep 26 22:10:21 2011 +0100
+++ b/tools/libxc/xenctrl.h Mon Sep 26 22:19:42 2011 +0100
@@ -351,6 +351,7 @@
unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
unsigned long nr_pages; /* current number, not maximum */
unsigned long nr_shared_pages;
+ unsigned long nr_paged_pages;
unsigned long shared_info_frame;
uint64_t cpu_time;
unsigned long max_memkb;
diff -r fef59e4eaf8d -r 651aed73b39c xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c Mon Sep 26 22:10:21 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c Mon Sep 26 22:19:42 2011 +0100
@@ -746,6 +746,9 @@
/* Put the page back so it gets freed */
put_page(page);
+ /* Track number of paged gfns */
+ atomic_inc(&d->paged_pages);
+
return 0;
}
@@ -831,6 +834,8 @@
audit_p2m(p2m, 1);
p2m_unlock(p2m);
+ atomic_dec(&d->paged_pages);
+
return 0;
}
diff -r fef59e4eaf8d -r 651aed73b39c xen/common/domctl.c
--- a/xen/common/domctl.c Mon Sep 26 22:10:21 2011 +0100
+++ b/xen/common/domctl.c Mon Sep 26 22:19:42 2011 +0100
@@ -137,6 +137,7 @@
info->tot_pages = d->tot_pages;
info->max_pages = d->max_pages;
info->shr_pages = atomic_read(&d->shr_pages);
+ info->paged_pages = atomic_read(&d->paged_pages);
info->shared_info_frame = mfn_to_gmfn(d, __pa(d->shared_info)>>PAGE_SHIFT);
BUG_ON(SHARED_M2P(info->shared_info_frame));
diff -r fef59e4eaf8d -r 651aed73b39c xen/include/public/domctl.h
--- a/xen/include/public/domctl.h Mon Sep 26 22:10:21 2011 +0100
+++ b/xen/include/public/domctl.h Mon Sep 26 22:19:42 2011 +0100
@@ -35,7 +35,7 @@
#include "xen.h"
#include "grant_table.h"
-#define XEN_DOMCTL_INTERFACE_VERSION 0x00000007
+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000008
/*
* NB. xen_domctl.domain is an IN/OUT parameter for this operation.
@@ -95,6 +95,7 @@
uint64_aligned_t tot_pages;
uint64_aligned_t max_pages;
uint64_aligned_t shr_pages;
+ uint64_aligned_t paged_pages;
uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
uint64_aligned_t cpu_time;
uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */
diff -r fef59e4eaf8d -r 651aed73b39c xen/include/xen/sched.h
--- a/xen/include/xen/sched.h Mon Sep 26 22:10:21 2011 +0100
+++ b/xen/include/xen/sched.h Mon Sep 26 22:19:42 2011 +0100
@@ -208,6 +208,7 @@
unsigned int tot_pages; /* number of pages currently possesed */
unsigned int max_pages; /* maximum value for tot_pages */
atomic_t shr_pages; /* number of shared pages */
+ atomic_t paged_pages; /* number of paged-out pages */
unsigned int xenheap_pages; /* # pages allocated from Xen heap */
unsigned int max_vcpus;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|