[libvirt] Virtio Ballon driver problem

Eric Blake eblake at redhat.com
Mon Dec 12 16:53:37 UTC 2011

On 12/11/2011 08:42 PM, Pankaj Rawat wrote:
> Well the process which get killed is the process running on guest trying
> to use memory , It is a simple c program having malloc function to do
> the memory requirement thing(Tested and working)
> The memory given to the guest is 400MB which is less then the maximum
> memory as specified rest of memory is with ballon

OK, so the process within the guest was killed because it used too much
memory and triggered the OOM killer in the guest.

> Now the virsh setmem command is correctly working but this has to be
> done manually . Didn't the documentation said that this is a dynamic
> process So each time a guest is running out of memory the host will
> fetch some memory from its own or other guest memory pages and give it
> to the guest which is running out of memory.

I don't know of any documentation that said that.  Point us to any URLs
that need corrections if you found misleading documentation.

I do know that existing documentation states that guest memory is not
backed by host memory until the guest actually touches the memory (that
is, you can oversubscribe memory among all the guests, and as long as
the guests don't touch all their memory, you won't force the host into
swap), but that is independent from the issue of the memory balloon -
the point of the balloon is that guests can only touch as much memory as
the balloon allows, and not for coordinating which host memory pages
back a guest memory page.

> Well I don't see that
> happening , instead of allocating more memory to guest VM . It is
> killing the process which is requesting more memory. 

The guest cannot trigger the balloon to request more memory.  Basically,
when the balloon is active, the guest can only use as much memory as is
not claimed by the balloon, and it takes host action to  change the size
of the balloon to allow the guest to use more memory.  Still, once you
change the size of the balloon, the memory isn't actually allocated to
the guest until the guest touches the page and forces the host to map
another page to the guest to cover that memory use.

> Can you help how can I achieve such dynamic behavior from the ballon
> driver so that I don't have to run command manually In order to get more
> memory ??

I don't think what you are asking for is possible.  If you want to
dynamically size guest memory according to guest workload, then in the
host, you will have to periodically check in on guest memory usage and
make a decision in the host to manually change the balloon allocations.

Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111212/085b9641/attachment-0001.sig>

More information about the libvir-list mailing list