From: Eric Blake <eblake redhat com>
To: d hee <coolio ymail com>
Cc: "libvirt-users redhat com" <libvirt-users redhat com>
Sent: Monday, October 17, 2011 12:43 PM
Subject: Re: [libvirt-users] Virtio Balloon- Can not see the results
On 10/13/2011 12:00 AM, d hee wrote:
> with kvm and virtio- would -m 1024 take proceedence over -balloon
> virtio? when i use both together, i see memory stay around 1024 MB less on my host side. I know the guest is not taking but a fraction of that ram, so I would expect the virtio balloon to take the majority of the guests ram and hand it back to the host. this is using the free util/command to take snapshots of the host memory.
Some helpful reading:https://rwmj.wordpress.com/2010/07/17/virtio-balloon/
Remember that libvirt defaults to using both -m (maximum memory) and a virtio balloon (using -device virtio-balloon-pci, rather than -balloon, but the concept is the same). As far as I know, there is _no way_ with current qemu to
start a guest with less than maximum memory; rather, you are forced to start with maximum then rely on balloon to reduce the usage back down. And this, unfortunately, requires guest cooperation. If the guest doesn't know how to use the virtio balloon driver, then you are stuck - the guest uses the maximum memory. That said, from the host side, memory usage is still under normal host memory management rules, even if ballooning doesn't work, where the host can swap out pages that have not yet been touched by the guest, so that not all of the memory attributed to the guest is actually tying up host pages.
There's certainly room for improvement here, but it has to start with qemu improvements.
-- Eric Blake eblake redhat com
Libvirt virtualization library http://libvirt.org