<div class="gmail_quote">On Mon, Dec 12, 2011 at 11:53 AM, Eric Blake <span dir="ltr"><<a href="mailto:eblake@redhat.com">eblake@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 12/11/2011 08:42 PM, Pankaj Rawat wrote:<br>
> Well the process which get killed is the process running on guest trying<br>
> to use memory , It is a simple c program having malloc function to do<br>
> the memory requirement thing(Tested and working)<br>
> The memory given to the guest is 400MB which is less then the maximum<br>
> memory as specified rest of memory is with ballon<br>
<br>
</div>OK, so the process within the guest was killed because it used too much<br>
memory and triggered the OOM killer in the guest.<br>
<div class="im"><br>
><br>
> Now the virsh setmem command is correctly working but this has to be<br>
> done manually . Didn't the documentation said that this is a dynamic<br>
> process So each time a guest is running out of memory the host will<br>
> fetch some memory from its own or other guest memory pages and give it<br>
> to the guest which is running out of memory.<br>
<br>
</div>I don't know of any documentation that said that.  Point us to any URLs<br>
that need corrections if you found misleading documentation.<br>
<br>
I do know that existing documentation states that guest memory is not<br>
backed by host memory until the guest actually touches the memory (that<br>
is, you can oversubscribe memory among all the guests, and as long as<br>
the guests don't touch all their memory, you won't force the host into<br>
swap), but that is independent from the issue of the memory balloon -<br>
the point of the balloon is that guests can only touch as much memory as<br>
the balloon allows, and not for coordinating which host memory pages<br>
back a guest memory page.<br>
<div class="im"><br>
> Well I don't see that<br>
> happening , instead of allocating more memory to guest VM . It is<br>
> killing the process which is requesting more memory.<br>
<br>
</div>The guest cannot trigger the balloon to request more memory.  Basically,<br>
when the balloon is active, the guest can only use as much memory as is<br>
not claimed by the balloon, and it takes host action to  change the size<br>
of the balloon to allow the guest to use more memory.  Still, once you<br>
change the size of the balloon, the memory isn't actually allocated to<br>
the guest until the guest touches the page and forces the host to map<br>
another page to the guest to cover that memory use.<br>
<div class="im"><br>
> Can you help how can I achieve such dynamic behavior from the ballon<br>
> driver so that I don't have to run command manually In order to get more<br>
> memory ??<br>
<br>
</div>I don't think what you are asking for is possible.  If you want to<br>
dynamically size guest memory according to guest workload, then in the<br>
host, you will have to periodically check in on guest memory usage and<br>
make a decision in the host to manually change the balloon allocations.<br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br class="Apple-interchange-newline">With a bit of work this could achieve the desired automation. Looks like it will be in oVirt at some point as well.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
--<br>
Eric Blake   <a href="mailto:eblake@redhat.com">eblake@redhat.com</a>    <a href="tel:%2B1-919-301-3266" value="+19193013266">+1-919-301-3266</a><br>
Libvirt virtualization library <a href="http://libvirt.org" target="_blank">http://libvirt.org</a><br>
<br>
</div></div><br>--<br>
libvir-list mailing list<br>
<a href="mailto:libvir-list@redhat.com">libvir-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libvir-list" target="_blank">https://www.redhat.com/mailman/listinfo/libvir-list</a><br></blockquote></div><br>