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

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



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


 


Rackspace

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