[pve-devel] balloon ugly hack

Derumier Alexandre aderumier at odiso.com
Fri Sep 16 04:46:25 CEST 2011


Here a ugly hack for ballooning.

it add balloon:  in config file and set value at vm start.


I have made test with linux and windows.

I had try the qemu maxmem parameter, it doesn't do nothing. (i think it's qemu-xen related).
The good method, is to start qemu with -m paramter, which is the max memory, and send balloon command to qemu monitor.

The vm start with max memory and balloon decrease memory only when the balloon driver is loaded in the guest.

test:

memory:4096
balloon:512

Linux
-----
memory:4096
balloon:512

vmstart
-------
vm start with maxmemory 4096 (but of course don't use this memory,guest need to fill it)

guest booting
----------
just after grub,when udev is launching, max memory decrease from 4096 to 512 in 2 seconds.
At this time,memory used is very slow, because linux don't have loaded things in memory.

guest fully started
-------------------
when i'm logging to vm, "free" command show 512MB memory and cat /proc/meminfo too.

if i do qmonitor command : balloon 2048  , free show 2048 total memory.
then after balloon 1024 : free show 1024 memory.
Balloon is fast, 2-3 seconds to reduce each time (with datas in memory).



Windows (the fun begin;)
------------------------
memory:4096
balloon:3000

vm start
---------
vm start with maxmemory 4096 (but of course don't use this memory,guest need to fill it)

guest booting
----------
Windows fill up all the memory with zero pages at boot, so the max memory is used.
Ballooning decrease memory just before login display, but it's really slowwwwww as hell.
I count, i take 2min to decrease memory from 4000MB to 3000MB.

guest fully started
-------------------
when i look windows taskmgr, i see always 4096 memory. but windows can use more than 3000MB.
So display is quite different than Linux. (I suppose windows can't play with dynamic memory change).
So balloon device, take the 1024MB, and windows can't go higher than 3000MB.

if I launch qmonitor comand :balloon 4096, windows can use all the memory again.

if I launch qmonitor comand :balloon 1024, it take again 5-6 minutes to decrease.




So my point is :

Ballooning on linux rocks :)
Ballooning on windows sucks :/






More information about the pve-devel mailing list