Mailing List Archive

[PATCH 5 of 8] Tools: Expose to libxc the total number of shared frames and space saved
tools/libxc/xc_private.c | 10 ++++++++++
tools/libxc/xenctrl.h | 4 ++++
2 files changed, 14 insertions(+), 0 deletions(-)


Signed-off-by: Adin Scannell <adin@scannell.ca>

diff -r a22140d92931 -r 6e8b8fb2c8b2 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -533,6 +533,16 @@ long xc_maximum_ram_page(xc_interface *x
return do_memory_op(xch, XENMEM_maximum_ram_page, NULL, 0);
}

+long xc_sharing_freed_pages(xc_interface *xch)
+{
+ return do_memory_op(xch, XENMEM_get_sharing_freed_pages, NULL, 0);
+}
+
+long xc_sharing_used_frames(xc_interface *xch)
+{
+ return do_memory_op(xch, XENMEM_get_sharing_shared_pages, NULL, 0);
+}
+
long long xc_domain_get_cpu_usage( xc_interface *xch, domid_t domid, int vcpu )
{
DECLARE_DOMCTL;
diff -r a22140d92931 -r 6e8b8fb2c8b2 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -1227,6 +1227,10 @@ int xc_mmuext_op(xc_interface *xch, stru
/* System wide memory properties */
long xc_maximum_ram_page(xc_interface *xch);

+long xc_sharing_freed_pages(xc_interface *xch);
+
+long xc_sharing_used_frames(xc_interface *xch);
+
/* Get current total pages allocated to a domain. */
long xc_get_tot_pages(xc_interface *xch, uint32_t domid);


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 5 of 8] Tools: Expose to libxc the total number of shared frames and space saved [ In reply to ]
On Fri, 2011-12-09 at 23:15 +0000, Andres Lagar-Cavilla wrote:
> tools/libxc/xc_private.c | 10 ++++++++++
> tools/libxc/xenctrl.h | 4 ++++
> 2 files changed, 14 insertions(+), 0 deletions(-)
>
>
> Signed-off-by: Adin Scannell <adin@scannell.ca>

If you pass on someone elses work I think it is normal to add your own
Signed-off-by (per DCO clause (c)).

[...]
> diff -r a22140d92931 -r 6e8b8fb2c8b2 tools/libxc/xenctrl.h
> --- a/tools/libxc/xenctrl.h
> +++ b/tools/libxc/xenctrl.h
> @@ -1227,6 +1227,10 @@ int xc_mmuext_op(xc_interface *xch, stru
> /* System wide memory properties */
> long xc_maximum_ram_page(xc_interface *xch);
>
> +long xc_sharing_freed_pages(xc_interface *xch);
> +
> +long xc_sharing_used_frames(xc_interface *xch);

A quick comment on what each function returns might be worthwhile, maybe
it's obvious to someone who knows the sharing stuff, but e.g. does
"used" mean used right now or does it mean have ever been used? I
suppose "freed" must be historical.

Also why pages vs frames? The underlying domctl is always pages.

Ian.

> +
> /* Get current total pages allocated to a domain. */
> long xc_get_tot_pages(xc_interface *xch, uint32_t domid);
>



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 5 of 8] Tools: Expose to libxc the total number of shared frames and space saved [ In reply to ]
> On Fri, 2011-12-09 at 23:15 +0000, Andres Lagar-Cavilla wrote:
>> tools/libxc/xc_private.c | 10 ++++++++++
>> tools/libxc/xenctrl.h | 4 ++++
>> 2 files changed, 14 insertions(+), 0 deletions(-)
>>
>>
>> Signed-off-by: Adin Scannell <adin@scannell.ca>
>
> If you pass on someone elses work I think it is normal to add your own
> Signed-off-by (per DCO clause (c)).
>
> [...]
>> diff -r a22140d92931 -r 6e8b8fb2c8b2 tools/libxc/xenctrl.h
>> --- a/tools/libxc/xenctrl.h
>> +++ b/tools/libxc/xenctrl.h
>> @@ -1227,6 +1227,10 @@ int xc_mmuext_op(xc_interface *xch, stru
>> /* System wide memory properties */
>> long xc_maximum_ram_page(xc_interface *xch);
>>
>> +long xc_sharing_freed_pages(xc_interface *xch);
>> +
>> +long xc_sharing_used_frames(xc_interface *xch);
We'll comment, certainly. For the record:

used_frames indicates the number of frames of memory that are shared,
each, by two or more domains. We use the term "frame" because it's
commonly used in textbooks for MMUs, in the sense that "a frame hosts a
page" or "a page maps to a frame". Thus our use of shared frames,
representing a different page (albeit with identical contents) to
different domains.

freed_pages indicates the number of individual pages freed as a result of
sharing. These are pages, one per domain.

Andres
>
> A quick comment on what each function returns might be worthwhile, maybe
> it's obvious to someone who knows the sharing stuff, but e.g. does
> "used" mean used right now or does it mean have ever been used? I
> suppose "freed" must be historical.
>
> Also why pages vs frames? The underlying domctl is always pages.
>
> Ian.
>
>> +
>> /* Get current total pages allocated to a domain. */
>> long xc_get_tot_pages(xc_interface *xch, uint32_t domid);
>>
>
>
>



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 5 of 8] Tools: Expose to libxc the total number of shared frames and space saved [ In reply to ]
On Mon, Dec 12, 2011 at 10:43 PM, Andres Lagar-Cavilla
<andres@lagarcavilla.org> wrote:
> used_frames indicates the number of frames of memory that are shared,
> each, by two or more domains. We use the term "frame" because it's
> commonly used in textbooks for MMUs, in the sense that "a frame hosts a
> page" or "a page maps to a frame". Thus our use of shared frames,
> representing a different page (albeit with identical contents) to
> different domains.

As Andres has pointed out, I named it frames to clearly differentiate
it from other page-based domctls (it worked!). With the unusual
condition of multiple domains pointing to the same frame, the
nomenclature gets a bit hairy. Any suggestions on this front?

> freed_pages indicates the number of individual pages freed as a result of
> sharing. These are pages, one per domain.

Here's a quick explanation and reason for these stats:

The way I see it, there are three easy-to-track, non-historical stats
about sharing.
X - The total number of domain pages that map to shared frames.
Y - The number of frames saved with sharing.
Z - The total number of shared frames (i.e. pages owned by dom_cow).

Any two of these will give you the third (via X = Y + Z). In this
case, we used Y & Z because I think that they are the simplest to
reason about (and therefore the most likely to be wanted). An
argument could easily be made for others though, if someone feels
strongly.

There are certainly some historical stats (# of unshares, etc.) and
lots of per-page/frame stats that would be of interest as well. But,
bit by bit...

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 5 of 8] Tools: Expose to libxc the total number of shared frames and space saved [ In reply to ]
On Tue, 2011-12-13 at 17:08 +0000, Adin Scannell wrote:
> On Mon, Dec 12, 2011 at 10:43 PM, Andres Lagar-Cavilla
> <andres@lagarcavilla.org> wrote:
> > used_frames indicates the number of frames of memory that are shared,
> > each, by two or more domains. We use the term "frame" because it's
> > commonly used in textbooks for MMUs, in the sense that "a frame hosts a
> > page" or "a page maps to a frame". Thus our use of shared frames,
> > representing a different page (albeit with identical contents) to
> > different domains.
>
> As Andres has pointed out, I named it frames to clearly differentiate
> it from other page-based domctls (it worked!). With the unusual
> condition of multiple domains pointing to the same frame, the
> nomenclature gets a bit hairy. Any suggestions on this front?

Nothing useful, your explanation makes sense and I can't think of a
better way of putting it.

It would be good if you described these semantics in the section of
xl(1) dealing with whichever command displays them (perhaps xl info if
you add the numbers to physinfo?).

> > freed_pages indicates the number of individual pages freed as a result of
> > sharing. These are pages, one per domain.
>
> Here's a quick explanation and reason for these stats:
>
> The way I see it, there are three easy-to-track, non-historical stats
> about sharing.
> X - The total number of domain pages that map to shared frames.
> Y - The number of frames saved with sharing.
> Z - The total number of shared frames (i.e. pages owned by dom_cow).
>
> Any two of these will give you the third (via X = Y + Z). In this
> case, we used Y & Z because I think that they are the simplest to
> reason about (and therefore the most likely to be wanted). An
> argument could easily be made for others though, if someone feels
> strongly.
>
> There are certainly some historical stats (# of unshares, etc.) and
> lots of per-page/frame stats that would be of interest as well. But,
> bit by bit...

Sure...

Ian.




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel