WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Question about memory management in Xen

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] Question about memory management in Xen
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Thu, 25 Oct 2007 18:42:00 +0100
Cc: Haifeng He <hehaifeng2nd@xxxxxxxxx>
Delivery-date: Thu, 25 Oct 2007 10:42:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <ab08258e0710250142h588080er6404897cb358b242@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <ab08258e0710250142h588080er6404897cb358b242@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)
> I have a question about the memory management in Xen. Suppose I start
> 2 DomU instances and both of them use the same kernel image. In this case,
>
> 1) will Xen make two copy of the kernel image in the memory, i.e., occupy
> 2*sizeof(kernel image) space in the physical memory or,

This is the case under Xen.  Each domain gets built in entirely separate 
memory and the kernel is copied into there.

> 2) will Xen only have one copy of the read-only pages of the kernel
> image (for instance, text section, rodata section) in the physical
> memory? Because I read
> somewhere about that, Unix will only have one copy of read-only pages in
> the memory and share them among processes.  How about Xen? Any thoughts?

Xen doesn't share memory in this case.  This costs some space but kernel 
images are typically not that large compared to the total memory used by a 
VM.  The Xen model basically gives each guest a separate, independent memory 
like a real machine would.  Most VMMs at least try to present this appearance 
to the guest.

I know that VMware ESX is able to unify identical pages between virtual 
machines once they're are running in order to save memory.  This applies to 
both kernel and userspace pages, both code and data.  I don't definitely know 
of any other x86-based VMM which does sharing like this.

IBM's zSeries boxes can share memory for things like kernel text, but they use 
a special kind of memory segment for this.  The memory management 
architecture of the zSeries is pretty strange, coming from an x86 background.

In principle, Xen could unify identical pages in a similar way to VMware ESX 
by using shadow pagetables.  Another option would be getting guests to 
co-operate explicitly (I've been hacking on something similar to this) with 
the sharing.  The "Potemkin virtual honey farm" uses shadow pagetables to 
allow guests that have been "forked" from a common parent to share memory in 
a copy-on-write fashion.

Hope that helps.

Cheers,
Mark

-- 
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!

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

<Prev in Thread] Current Thread [Next in Thread>