From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FzNkv-0007rR-Op for qemu-devel@nongnu.org; Sat, 08 Jul 2006 21:06:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FzNku-0007pK-4g for qemu-devel@nongnu.org; Sat, 08 Jul 2006 21:06:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FzNkt-0007pB-Uo for qemu-devel@nongnu.org; Sat, 08 Jul 2006 21:06:39 -0400 Received: from [66.249.92.171] (helo=ug-out-1314.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FzNle-0004wK-K2 for qemu-devel@nongnu.org; Sat, 08 Jul 2006 21:07:26 -0400 Received: by ug-out-1314.google.com with SMTP id j40so1091885ugd for ; Sat, 08 Jul 2006 18:06:38 -0700 (PDT) Message-ID: <946a3fda0607081806r56d18980vd00f570de44a1466@mail.gmail.com> Date: Sat, 8 Jul 2006 20:06:38 -0500 From: "Eric L" Subject: Re: [Qemu-devel] balloon driver In-Reply-To: <200607051552.12914.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <946a3fda0607041958p2e5daab3o2c6d3f633aafc089@mail.gmail.com> <200607051552.12914.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org On 7/5/06, Paul Brook wrote: > On Wednesday 05 July 2006 03:58, Eric L wrote: > > I've been playing around with QEMU the past few days and have been > > quite impressed. One thing I wondered about: it seems that most of > > the other virtualization schemes have some sort of balloon driver to > > reclaim unused (cached) guest memory. (VMWare, Xen and I think user > > mode linux has something too). It seems like a pretty good idea to > > me, but from my searching, it would appear that QEMU does not have > > anything similar. Is this correct? If so, is there a reason why? > > Partly because qemu is just a normal user application. It can be swapped out > by the host OS just like any other process. Adding a few Gb of extra swap and > letting the host OS figure it out should get you 90% of the benefit. > > Paul > It seems the point of the balloon driver is to avoid forcing the host to swap. For example, suppose I start a new guest OS. I check the memory usage on the host and everything looks pretty good, maybe 30MB used. Then suppose I run a recursive grep command in a Linux source tree on the guest. The host memory usage will climb to the maximum allotted memory as the guest OS fills its page cache with pages of kernel source. Now, I go back to the host and decide I want to run something a little memory intensive. The host has to swap and dutifully copies those pages of kernel source to swap. Much better would be if I could just chuck those pages and give them back to the host, no swapping at all. Even if the guest has to swap, the reasoning is that the guest is in a much better position to figure out what to swap than if the host were forced to. It is a rather crude approach and I'm not sure how much practical benefit there is, but I'll probably go ahead and code it up (at least for a Linux host) if only for myself as it looks pretty simple. (Linux 2.6.16 added the ability to punch holes in tmpfs files so all the hard work should be done). I just wondered if there was anything I was missing or if anyone had considered it before. - E