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-users

Re: [Xen-users] Vanishing memory? Whats going on?

To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-users] Vanishing memory? Whats going on?
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Wed, 9 Jul 2008 15:42:42 +0100
Cc: John Haxby <john.haxby@xxxxxxxxxx>, bleomycin <diabolical@xxxxxxxxx>
Delivery-date: Wed, 09 Jul 2008 07:43:24 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <486DF14D.2040803@xxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <18269784.post@xxxxxxxxxxxxxxx> <486DF14D.2040803@xxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.9
I'd like to expand a bit on John's excellent points...

On Friday 04 July 2008, John Haxby wrote:
> bleomycin wrote:
> > Hello everyone, i just installed xen on standard debian etch server. 4gb
> > ram, Q6600 machine. I am running two hvm guests, one windows 2k3, the
> > other debian etch, both with 512mb ram allocated. What i dont understand
> > is that when i start a guest OS the amount of total ram known to the host
> > machine seems to vanish? Free -m and top both report that with both
> > guests running i only have 2.9gb of total system memory. If i attempt to
> > start a third guest, hvm xubuntu, with 512mb of ram allocated to it i get
> > the error "Error: (12, 'Cannot allocate memory')" Please forgive me for
> > such a trivial question, but i have searched these forums and google to
> > the best of my ability and i keep coming up blank :(
>
> What you're looking at with "free -m" is, I would imagine, the memory
> available to dom0 and that would make sense as the hypervisor takes a
> slice and then each domU takes 0.5GB leaving you with just shy of 3GB.

Yep.

The important point to understand is that by default, Xen gives dom0 all of 
the free memory in the machine (i.e. all the memory that the Xen hypervisor 
isn't using itself) but that dom0 has to *give back* this memory so that it 
can be *given* to other domains.  This results in dom0's view of the total 
memory shrinking.

To get a *true* idea of the free memory available in the entire machine, you 
use "xm info".  In practice, there will be very little free memory available 
by default, since it is reclaimed dynamically from dom0.

> If you can't create a third domU then its because the balloon driver in
> dom0 can't reclaim enough memory to start the new domain: generally
> speaking the balloon driver will "acquire" memory from the cache.

Yep, agreed.

> You could try setting dom0_mem=1024M (for example) on the kernel command
> line in grub  (there's a kernel line and a couple of module lines
> normally).   That will leave you with just short of 3GB for guests.

You can also adjust the value of dom0-min-mem in /etc/xen/xend-config.sxp in 
order to allow dom0 to be shrunk smaller in order to free space for other 
guests.

For production servers with a stable set of guests, it's generally recommended 
to disable auto-ballooning (automatic resizing) of dom0 by setting 
dom0-min-mem to the special value of 0, then set the dom0_mem= parameter on 
the Xen commandline so that dom0 starts with the right proportion of machine 
memory.

> Oh, and if you have the choice then go for pv guests rather than hvm
> because having a kernel that knows its in a virtual environment is
> generally an advantage.

Yep.

Cheers,
Mark


-- 
Push Me Pull You - Distributed SCM tool (http://www.cl.cam.ac.uk/~maw48/pmpu/)

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