[CentOS-virt] centos6 and xen4 dom0 memory allocation

Sun Jul 8 17:00:10 UTC 2012
Pasi Kärkkäinen <pasik at iki.fi>

On Sun, Oct 23, 2011 at 08:54:13PM +0300, Peter Peltonen wrote:
> Replying to myself:
> On Sun, Oct 23, 2011 at 5:51 PM, Peter Peltonen
> <peter.peltonen at gmail.com> wrote:
> > There is something fishy going around... I will now try to yum update
> > dom0 and domUs, set the dom0-min-mem to 2048M and reboot and see what
> > happens.
> After rebooting I seemed to have 2048M in dom0 regardless of how many
> domUs were running.
> But when trying to create the last domU, I was informed that xend was
> out of memory. At this time I still had something about 5G of real
> memory available for the  last domU which I have configured to consume
> 4G of memory.
> I tweaked grub.conf and xend-config.sxp and set 4096M as the dom0
> memory and rebooted again. I reduced the domU memory sizes accordingly
> and all domUs got created without errors. But the strange thing is
> again dom0 memory which has been reduced from 4096M to 2052M:
> [root at si ~]# cat /etc/xen/xend-config.sxp |grep dom0-min-mem
> # dom0-min-mem is the lowest permissible memory level (in MB) for dom0.
> (dom0-min-mem 4096)
> [root at si ~]# xl info |grep mem
> total_memory           : 24567
> free_memory            : 5853
> xen_commandline        : dom0_mem=4096M dom0_max_vcpus=1 dom0_vcpus_pin
> [root at si ~]# xl list
> Name                                        ID   Mem VCPUs      State   Time(s)
> Domain-0                                     0  2052     1     r-----     265.6
> xl top reports "(MEM)k" as "2101272" and "MAXMEM(k)" as "no limit".
> In CentOS5 with Xen3 I have been used to having the amount of memory
> in dom0 which I have specified. My Xen4 installation seems not to do
> this.
> If someone else is using the Xen4 packages from
> http://xenbits.xen.org/people/mayoung/EL6.xen I would be interested in
> hearing about your experiences?

Replying to an old thread.. two things:

1) you might need to use "dom0_mem=2048M,max:2048M" parameter for Xen hypervisor to give the maximum upper limit for dom0.

2) (Earlier) there was a bug in the dom0 kernel code where it allocated wrong amount of memory; you had to use "mem=2048M" option for Linux dom0 kernel in addition to the dom0_mem= option for Xen to get the correct amount of memory for dom0.

-- Pasi