[libvirt] Virtio Ballon driver problem

Hi .well I am trying to use virtioballon driver on my KVM host . I have assigned 400 MB current memory to my guest The ballon size is 600MB but when I used all the 400MB of guest the RAM of guest is not increasing. I watch the ram usage by running following command #free -m But the guest is only using memory upto 400MB after that the process is killed . I don't see the ballon driver coming into picture. It is not doing anything The ballon driver is loaded in host as well as guest DISCLAIMER: ----------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or NECHCL or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of NECHCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. . -----------------------------------------------------------------------------------------------------------------------

On 12/09/2011 02:39 AM, Pankaj Rawat wrote:
Hi .well I am trying to use virtioballon driver on my KVM host . I have assigned 400 MB current memory to my guest
The ballon size is 600MB but when I used all the 400MB of guest the RAM of guest is not increasing.
I watch the ram usage by running following command
#free -m
Is that in the host or in the guest?
But the guest is only using memory upto 400MB after that the process is killed .
Which process? The guest process trying to use memory, or the host qemu process running the guest? Can you show actual transcripts of your testing? Assigning 400MiB current memory to the guest implies that the balloon driver in the guest will prevent the guest from using more than 400MiB, even if the max allocation is higher. The balloon driver in the guest does not have the ability to dynamically request more memory from the host, rather, balloon expansion or contraction is controlled by host actions.
I don't see the ballon driver coming into picture. It is not doing anything
On the host, did you use the 'virsh setmem' command (or other language binding to access the virDomainSetMemory API), which is the documented way to have the host request the guest to change the allocation consumed by the guest's balloon driver?
The ballon driver is loaded in host as well as guest
The balloon driver only matters in the guest; it is a guest device designed for cooperation with host control.
DISCLAIMER: ----------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and
Disclaimers like this are unenforceable on publicly-archived mailing lists; you may want to consider sending mail from a different account that doesn't tack on this legalese. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

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 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. 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. 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 ?? -----Original Message----- From: Eric Blake [mailto:eblake@redhat.com] Sent: Friday, December 09, 2011 8:59 PM To: Pankaj Rawat Cc: libvir-list@redhat.com Subject: Re: [libvirt] Virtio Ballon driver problem On 12/09/2011 02:39 AM, Pankaj Rawat wrote:
Hi .well I am trying to use virtioballon driver on my KVM host . I have assigned 400 MB current memory to my guest
The ballon size is 600MB but when I used all the 400MB of guest the RAM of guest is not increasing.
I watch the ram usage by running following command
#free -m
Is that in the host or in the guest?
But the guest is only using memory upto 400MB after that the process is killed .
Which process? The guest process trying to use memory, or the host qemu process running the guest? Can you show actual transcripts of your testing? Assigning 400MiB current memory to the guest implies that the balloon driver in the guest will prevent the guest from using more than 400MiB, even if the max allocation is higher. The balloon driver in the guest does not have the ability to dynamically request more memory from the host, rather, balloon expansion or contraction is controlled by host actions.
I don't see the ballon driver coming into picture. It is not doing anything
On the host, did you use the 'virsh setmem' command (or other language binding to access the virDomainSetMemory API), which is the documented way to have the host request the guest to change the allocation consumed by the guest's balloon driver?
The ballon driver is loaded in host as well as guest
The balloon driver only matters in the guest; it is a guest device designed for cooperation with host control.
DISCLAIMER: ---------------------------------------------------------------------- ------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and
Disclaimers like this are unenforceable on publicly-archived mailing lists; you may want to consider sending mail from a different account that doesn't tack on this legalese. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org DISCLAIMER: ----------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or NECHCL or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of NECHCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. . -----------------------------------------------------------------------------------------------------------------------

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@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Mon, Dec 12, 2011 at 11:53 AM, Eric Blake <eblake@redhat.com> wrote:
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.
With a bit of work this could achieve the desired automation. Looks like it will be in oVirt at some point as well.
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (3)
-
Eric Blake
-
John Magee
-
Pankaj Rawat