On Wed, Feb 1, 2012 at 4:27 PM, Andres Lagar-Cavilla <
andres@lagarcavilla.org> wrote:
> > Date: Wed, 1 Feb 2012 13:05:55 -0500
> > From: Peter Deng <agent.peter123@gmail.com>
> > To: xen-devel@lists.xensource.com
> > Subject: [Xen-devel] Xen Mem Page Sharing
> > Message-ID:
> > <
> CAJy3yGDJAWJmPtgwr1esf+F+Y4kopV1FGvo8QOdDodKoYdTR-Q@mail.gmail.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Hi,
> >
> > I''m am looking into and doing some research on Memory Page
Sharing on
> Xen,
> > and I would like to know the current activity status regarding
Xen''s
> > memory
> > management. Also, while looking through the source code, I am having
some
> > trouble translating some of the functions, notably in mem_sharing.c,
and
> > one function I would like to have explained is mem_sharing_audit().
One
> > that note, is there recent documentation on Xen code or do I need to
> trace
> > the logs to determine development changes?
>
> Quite recently we effectively overhauled all the sharing support in the
> hypervisor. So it''s best you check out the latest xen-unstable
tree.
>
> The interface is relatively simple. You identify a page that is a
> candidate for sharing and you call nominate(domain, gfn). You get back a
> 64 bit handle. This is a unique identifier for this *version* of this
> guest page. Should the page change (writes) the handle won''t be
valid
> anymore.
>
> Once you have two candidates you can coalesce them by calling
> share(source_domain, source_gfn, source_handle, client_domain, client_gfn,
> client_handle). Voila! you''ve shared and saved memory. You can
reshare (to
> coalesce > 2 guest pages into a single backing shared page), but keep in
> mind that the client gfn and handle won''t be valid anymore for
further
> sharing.
>
> All the user-space visible code is in tools/libxc/xc_memshr.c, with
> prototypes in tools/libxc/xenctrl.h. As you found out, the hypervisor code
> is in arch/x86/mm/mem_sharing.c
>
> It is crucial to understand that the hypervisor won''t check the
contents
> of the pages. If you select the wrong candidates for sharing, you will
> crash your guest(s). However, the hypervisor will ensure that pages are
> properly unshared when writes happen.
>
> Hope this helps, agent Peter!
> Andres
> >
> > Thanks,
> >
> > Peter
>
>
>
Thanks for the explanation Andres,
So looking through the code, I am getting that the mechanisms for sharing
the pages are present within the hypervisor and the hypervisor will manage
the sharing and unsharing of pages. Now, this leads me into a question that
regards the implementation of sharing pages. In the research articles I
have read, hashing was used to determine the contents of similar pages; is
there code implementation present in Xen that does this or something
related in that area? If so, where is it in the source code?
Thanks,
Peter
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel