diff options
author | Olaf Hering <olafiaepfle.de> | 2011-09-26 22:19:42 +0100 |
---|---|---|
committer | Olaf Hering <olafiaepfle.de> | 2011-09-26 22:19:42 +0100 |
commit | 47e2593cc8a6f99d4b621228bd847b0b2d7e5cb3 (patch) | |
tree | 437c07793d2ce2fbacbc1a61f2560b4b3a5d47de /xen | |
parent | 5f47247ded7bcd5ae5126da30f09f105a59fdc8d (diff) | |
download | xen-47e2593cc8a6f99d4b621228bd847b0b2d7e5cb3.tar.gz xen-47e2593cc8a6f99d4b621228bd847b0b2d7e5cb3.tar.bz2 xen-47e2593cc8a6f99d4b621228bd847b0b2d7e5cb3.zip |
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@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
Diffstat (limited to 'xen')
-rw-r--r-- | xen/arch/x86/mm/p2m.c | 5 | ||||
-rw-r--r-- | xen/common/domctl.c | 1 | ||||
-rw-r--r-- | xen/include/public/domctl.h | 3 | ||||
-rw-r--r-- | xen/include/xen/sched.h | 1 |
4 files changed, 9 insertions, 1 deletions
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index c62aa12da7..b6fb4d8275 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -746,6 +746,9 @@ int p2m_mem_paging_evict(struct domain *d, unsigned long gfn) /* 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 @@ int p2m_mem_paging_prep(struct domain *d, unsigned long gfn) audit_p2m(p2m, 1); p2m_unlock(p2m); + atomic_dec(&d->paged_pages); + return 0; } diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 5f7194dc88..57c906cb75 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -137,6 +137,7 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info) 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 --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index ae512aac10..ea8fce63d9 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -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 @@ struct xen_domctl_getdomaininfo { 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 --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index c6b3a5916f..784bcecdab 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -208,6 +208,7 @@ struct domain 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; |