Xen : réservation de RAM pour le dom0 et désactivation du ballooning

Boris HUISGEN
|
Lors du boot noyau Linux, la quantité de RAM détectée (visible par l’OS) est utilisée entre autres pour l’allocation des buffers servant à la gestion réseau et au marquage des pages RAM. Dans le cas d’un dom0 sous Xen, il n’y a aucun intérêt à rendre visible l’ensemble de la RAM physique, vu qu’elle sera scindée et utilisée par la suite par les domU.
Ce billet présente comment allouer et limiter une quantité de RAM fixe au dom0, ici de 2 Go.
Mise en place
root@manjula:~# vim /etc/default/grub
GRUB_CMDLINE_XEN="dom0_mem=2048M";
root@manjula:~# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-5-xen-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-xen-amd64
Found linux image: /boot/vmlinuz-2.6.32-5-xen-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-xen-amd64
Found linux image: /boot/vmlinuz-2.6.32-5-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-amd64
done
root@manjula:~# vim /etc/xen/xend-config.sxp
# dom0-min-mem is the lowest permissible memory level (in MB) for dom0.
# This is a minimum both for auto-ballooning (as enabled by
# enable-dom0-ballooning below) and for xm mem-set when applied to dom0.
(dom0-min-mem 2048)
# Whether to enable auto-ballooning of dom0 to allow domUs to be created.
# If enable-dom0-ballooning = no, dom0 will never balloon out.
(enable-dom0-ballooning no)
root@manjula:~# shutdown -r now
root@manjula:~# free -m
total used free shared buffers cached
Mem: 2043 249 1794 0 8 50
-/+ buffers/cache: 190 1853
Swap: 15255 0 15255