[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/2] x86/mem-sharing: Bulk mem-sharing entire domains



On Sun, Oct 04, 2015 at 02:25:38PM -0600, Tamas K Lengyel wrote:
> Currently mem-sharing can be performed on a page-by-page base from the control
> domain. However, when completely deduplicating (cloning) a VM, this requires
> at least 3 hypercalls per page. As the user has to loop through all pages up
> to max_gpfn, this process is very slow and wasteful.
> 
> This patch introduces a new mem_sharing memop for bulk deduplication where
> the user doesn't have to separately nominate each page in both the source and
> destination domain, and the looping over all pages happen in the hypervisor.
> This significantly reduces the overhead of completely deduplicating entire
> domains.
> 
> Signed-off-by: Tamas K Lengyel <tlengyel@xxxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> Cc: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
> Cc: Keir Fraser <keir@xxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
>  tools/libxc/include/xenctrl.h     | 11 +++++
>  tools/libxc/xc_memshr.c           | 14 ++++++
>  xen/arch/x86/mm/mem_sharing.c     | 90 
> ++++++++++++++++++++++++++++++++++++++-
>  xen/arch/x86/x86_64/compat/mm.c   |  6 ++-
>  xen/arch/x86/x86_64/mm.c          |  6 ++-
>  xen/include/asm-x86/mem_sharing.h |  3 +-
>  xen/include/public/memory.h       |  1 +
>  7 files changed, 124 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
> index 3bfa00b..dd82549 100644
> --- a/tools/libxc/include/xenctrl.h
> +++ b/tools/libxc/include/xenctrl.h
> @@ -2594,6 +2594,17 @@ int xc_memshr_add_to_physmap(xc_interface *xch,
>                      domid_t client_domain,
>                      unsigned long client_gfn);
>  
> +/* Allows to deduplicate the entire memory of a client domain in bulk. Using
> + * this function is equivalent of calling xc_memshr_nominate_gfn for each gfn
> + * in the two domains followed by xc_memshr_share_gfns.
> + *
> + * May fail with EINVAL if the source and client domain have different
> + * memory size or if memory sharing is not enabled on either of the domains.
> + */
> +int xc_memshr_bulk_dedup(xc_interface *xch,
> +                         domid_t source_domain,
> +                         domid_t client_domain);
> +
>  /* Debug calls: return the number of pages referencing the shared frame 
> backing
>   * the input argument. Should be one or greater. 
>   *
> diff --git a/tools/libxc/xc_memshr.c b/tools/libxc/xc_memshr.c
> index deb0aa4..ecb0f5c 100644
> --- a/tools/libxc/xc_memshr.c
> +++ b/tools/libxc/xc_memshr.c
> @@ -181,6 +181,20 @@ int xc_memshr_add_to_physmap(xc_interface *xch,
>      return xc_memshr_memop(xch, source_domain, &mso);
>  }
>  
> +int xc_memshr_bulk_dedup(xc_interface *xch,
> +                         domid_t source_domain,
> +                         domid_t client_domain)
> +{
> +    xen_mem_sharing_op_t mso;
> +
> +    memset(&mso, 0, sizeof(mso));
> +
> +    mso.op = XENMEM_sharing_op_bulk_dedup;
> +    mso.u.share.client_domain = client_domain;
> +
> +    return xc_memshr_memop(xch, source_domain, &mso);
> +}
> +

Tools bits:

Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.