Olaf Hering
2011-Sep-15 12:26 UTC
[Xen-devel] [PATCH] xenpaging: track number of paged pages in struct domain
# HG changeset patch # User Olaf Hering <olaf@aepfle.de> # Date 1316089500 -7200 # Node ID 13b4be345ebac016abe26386417824a0c47d762d # Parent e90438f6e6d1585a71b18784a99c162b5d95f390 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> diff -r e90438f6e6d1 -r 13b4be345eba tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -235,6 +235,7 @@ int xc_domain_getinfo(xc_interface *xch, 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 e90438f6e6d1 -r 13b4be345eba tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -351,6 +351,7 @@ typedef struct xc_dominfo { 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 e90438f6e6d1 -r 13b4be345eba xen/arch/x86/mm/p2m.c --- 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 * /* 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 audit_p2m(p2m, 1); p2m_unlock(p2m); + atomic_dec(&d->paged_pages); + return 0; } diff -r e90438f6e6d1 -r 13b4be345eba xen/common/domctl.c --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -137,6 +137,7 @@ void getdomaininfo(struct domain *d, str 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 e90438f6e6d1 -r 13b4be345eba xen/include/public/domctl.h --- 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 -r e90438f6e6d1 -r 13b4be345eba xen/include/xen/sched.h --- 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; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2011-Sep-16 11:24 UTC
Re: [Xen-devel] [PATCH] xenpaging: track number of paged pages in struct domain
At 14:26 +0200 on 15 Sep (1316096767), Olaf Hering wrote:> # HG changeset patch > # User Olaf Hering <olaf@aepfle.de> > # Date 1316089500 -7200 > # Node ID 13b4be345ebac016abe26386417824a0c47d762d > # Parent e90438f6e6d1585a71b18784a99c162b5d95f390 > 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>For the xen parts, Acked-by: Tim Deegan <tim@xen.org> Again, I''d like the tools maintainers to ack/nack the change to the domctl interface and associated libxc plumbing. Cheers, Tim. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Olaf Hering
2011-Sep-16 11:32 UTC
Re: [Xen-devel] [PATCH] xenpaging: track number of paged pages in struct domain
On Fri, Sep 16, Tim Deegan wrote:> At 14:26 +0200 on 15 Sep (1316096767), Olaf Hering wrote: > > # HG changeset patch > > # User Olaf Hering <olaf@aepfle.de> > > # Date 1316089500 -7200 > > # Node ID 13b4be345ebac016abe26386417824a0c47d762d > > # Parent e90438f6e6d1585a71b18784a99c162b5d95f390 > > 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> > > For the xen parts, Acked-by: Tim Deegan <tim@xen.org> > > Again, I''d like the tools maintainers to ack/nack the change to the domctl > interface and associated libxc plumbing.Thanks, but please wait a bit before applying it. Eventually a new XENMEM op is required as well to export that value for a guests balloon driver. I''m not finished yet with browsing the codepaths which make use of tot_pages. Olaf _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Sep-21 09:26 UTC
Re: [Xen-devel] [PATCH] xenpaging: track number of paged pages in struct domain
On Fri, 2011-09-16 at 12:24 +0100, Tim Deegan wrote:> At 14:26 +0200 on 15 Sep (1316096767), Olaf Hering wrote: > > # HG changeset patch > > # User Olaf Hering <olaf@aepfle.de> > > # Date 1316089500 -7200 > > # Node ID 13b4be345ebac016abe26386417824a0c47d762d > > # Parent e90438f6e6d1585a71b18784a99c162b5d95f390 > > 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> > > For the xen parts, Acked-by: Tim Deegan <tim@xen.org> > > Again, I''d like the tools maintainers to ack/nack the change to the domctl > interface and associated libxc plumbing.They look alright to me: Acked-by: Ian Campbell <ian.campbell@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Olaf Hering
2011-Sep-23 16:19 UTC
Re: [Xen-devel] [PATCH] xenpaging: track number of paged pages in struct domain
On Fri, Sep 16, Olaf Hering wrote:> > For the xen parts, Acked-by: Tim Deegan <tim@xen.org> > > > > Again, I''d like the tools maintainers to ack/nack the change to the domctl > > interface and associated libxc plumbing. > > Thanks, but please wait a bit before applying it. > Eventually a new XENMEM op is required as well to export that value for > a guests balloon driver. I''m not finished yet with browsing the > codepaths which make use of tot_pages.Please go ahead with applying. The balloon driver does not need to know about paged pages, its job is to just free as many pages as it is asked for by xenstore or sysfs. Olaf _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2011-Sep-26 21:23 UTC
Re: [Xen-devel] [PATCH] xenpaging: track number of paged pages in struct domain
At 18:19 +0200 on 23 Sep (1316801950), Olaf Hering wrote:> On Fri, Sep 16, Olaf Hering wrote: > > > > For the xen parts, Acked-by: Tim Deegan <tim@xen.org> > > > > > > Again, I''d like the tools maintainers to ack/nack the change to the domctl > > > interface and associated libxc plumbing. > > > > Thanks, but please wait a bit before applying it. > > Eventually a new XENMEM op is required as well to export that value for > > a guests balloon driver. I''m not finished yet with browsing the > > codepaths which make use of tot_pages. > > Please go ahead with applying. > The balloon driver does not need to know about paged pages, its job is > to just free as many pages as it is asked for by xenstore or sysfs.Applied, thanks. Is that all the outstanding xenpaging patches? Tim. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Olaf Hering
2011-Sep-27 07:35 UTC
Re: [Xen-devel] [PATCH] xenpaging: track number of paged pages in struct domain
On Mon, Sep 26, Tim Deegan wrote:> Applied, thanks. Is that all the outstanding xenpaging patches?No, I have a dozen more in the queue, both tools and xen changes. Olaf _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel