* Xen Mem Page Sharing -> Implementation
@ 2012-02-08 18:07 Peter Deng
2012-02-10 13:44 ` Tim Deegan
0 siblings, 1 reply; 2+ messages in thread
From: Peter Deng @ 2012-02-08 18:07 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 2855 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 3626 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Xen Mem Page Sharing -> Implementation
2012-02-08 18:07 Xen Mem Page Sharing -> Implementation Peter Deng
@ 2012-02-10 13:44 ` Tim Deegan
0 siblings, 0 replies; 2+ messages in thread
From: Tim Deegan @ 2012-02-10 13:44 UTC (permalink / raw)
To: Peter Deng; +Cc: xen-devel
Hi,
At 13:07 -0500 on 08 Feb (1328706468), Peter Deng wrote:
> 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?
No, Xen itself does not contain any code for selecting which pages to
share. We leave that to the tools.
Incidentally, here are some reasons why hashing pages of RAM and
scanning for duplicates might not be such a great idea:
http://www.usenix.org/events/usenix09/tech/full_papers/milos/milos_html/index.html
(N.B.: that paper does _not_ describe the page-sharing interface that's
currently in Xen; Satori was a research prototype for sharing memory
between _PV_ guests).
Tim.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-10 13:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-08 18:07 Xen Mem Page Sharing -> Implementation Peter Deng
2012-02-10 13:44 ` Tim Deegan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).