On Tue, Oct 6, 2015 at 8:52 AM, Andrew Cooper <andrew.coop...@citrix.com>
wrote:

> On 06/10/15 15:26, Ian Campbell wrote:
> > On Sun, 2015-10-04 at 14:25 -0600, Tamas K Lengyel wrote:
> >> The following patches add a convenience memop to the mem_sharing system,
> >> allowing for the rapid deduplication of memory pages between identical
> >> domains.
> >>
> >> The envisioned use-case for this is the following:
> >> 1) Create two domains from the same snapshot using xl.
> >>    This step can also be performed by piping an existing domain's memory
> >> with
> >>         "xl save -c <domain> <pipe> | xl restore -p <new_cfg> <pipe>"
> >>    It is up for the user to create the appropriate configuration for the
> >> clone,
> >>    including setting up a CoW-disk as well.
> >> 2) Enable memory sharing on both domains
> >> 3) Execute bulk dedup between the domains.
> > This is a neat trick, but has the downside of first shovelling all the
> data
> > over a pipe and then needing to allocate it transiently before dedupping
> it
> > again.
> >
> > Have you looked at the possibility of doing the save+restore in the same
> > process with a cut through for the RAM part which just dups the page into
> > the target domain?
> >
> > Once upon a time (migr v1) that would certainly have been impossibly
> hard,
> > but with migr v2 it might be a lot easier to integrate something like
> that
> > (although surely not as easy as what you've done here!).
> >
> > Just an idea, and not intended at all as an argument for not taking this
> > series or anything.
>
> If we are making modifications like this, make something like
> XEN_DOMCTL_domain_clone which takes a source domid (must exist), pauses
> it, creates a new domain, copies some state and shares all memory CoW
> from source to the new domain.
>
> This will be far more efficient still than moving all the memory through
> userspace in dom0.
>
> ~Andrew
>

It would be far more efficient, but unfortunately there is more to cloning
then just the hypervisor side. Andres already made and suggested using
xc_memshr_add_to_physmap, which could be used during domain creation to do
something similar. However, 1) there is no reference implementation on how
to do that domain creation cleanly 2) cloning HVM domains also requires
cloning QEMU. As the only reference implementation on how to create an HVM
domain from scratch is in libxl right now, it's a pretty huge task to
untangle it to make something like this happen (at least for me). I've been
staring at this from time-to-time for the past couple years and I'm still
no closer to a working solution. In the interim, this patch at least
improves something that I know that works and requires minimal changes to
the tools/hypervisor.

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

Reply via email to