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

Re: [Xen-devel] Xen Mem Page Sharing


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: "Andres Lagar-Cavilla" <andres@xxxxxxxxxxxxxxxx>
  • Date: Wed, 1 Feb 2012 13:27:13 -0800
  • Cc: agent.peter123@xxxxxxxxx
  • Delivery-date: Wed, 01 Feb 2012 21:27:40 +0000
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=lagarcavilla.org; h=message-id :in-reply-to:references:date:subject:from:to:cc:reply-to :mime-version:content-type:content-transfer-encoding; q=dns; s= lagarcavilla.org; b=rNz3WQG2DljfPcJ2Daw9m6L9Bhdfzl7pLJMBcLAnlZ11 OZuvpA7F9b6LR5iby6kUd9h4ypjDZp7Errd9NyPGGah88H/Z4udnvS6aCfqyEki6 5GJARRIloTMTeVcV9Vn29uJum0cN24kerAFHQEt/M+Q1KamwHCJCnxCNgUa1MRs=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

> Date: Wed, 1 Feb 2012 13:05:55 -0500
> From: Peter Deng <agent.peter123@xxxxxxxxx>
> To: xen-devel@xxxxxxxxxxxxxxxxxxx
> Subject: [Xen-devel] Xen Mem Page Sharing
> Message-ID:
>       <CAJy3yGDJAWJmPtgwr1esf+F+Y4kopV1FGvo8QOdDodKoYdTR-Q@xxxxxxxxxxxxxx>
> 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



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


 


Rackspace

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