From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Memory under KVM? Date: Sun, 13 Dec 2009 12:08:13 +0200 Message-ID: <4B24BD0D.8070003@redhat.com> References: <4B22BCE5.7040208@binaryfreedom.info> <4B234FB7.8010804@redhat.com> <200912121337.59872.tfjellstrom@shaw.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: tfjellstrom@shaw.ca Return-path: Received: from mx1.redhat.com ([209.132.183.28]:6187 "HELO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751948AbZLMKIP (ORCPT ); Sun, 13 Dec 2009 05:08:15 -0500 In-Reply-To: <200912121337.59872.tfjellstrom@shaw.ca> Sender: kvm-owner@vger.kernel.org List-ID: On 12/12/2009 10:37 PM, Thomas Fjellstrom wrote: > > I have the opposite happen, when a VM is started, RES is usually lower than > -m, which I find slightly odd. But makes sense if qemu/kvm don't actually > allocate memory from the host till its requested the first time That is the case. > (if only it > would return some of it afterwards, it would be even better). > Use the balloon driver to return memory to the host. > I just fully shut down and restarted on of my vms, which is set to use > 128-256 MB ram max. RES is like 72MB on start, and VIRT is 454M. RES > generally gets up around 120MB ram when its doing something. > > One thing I do find a little odd is one of my VMs which is allocated 512MB > ram, has a VIRT of 826MB ram. I didn't realize that qemu had so many lib > dependencies. It's not just libraries, it's mostly glibc malloc() allocating huge pools per thread, as well as large thread stacks. > Due to kvm not supporting giving memory back, besides by > swapping large portions of unused guest ram, my host currently has over 1G > used swap. Not particularly happy with that, but it doesn't seem to effect > performance too much (except that it generally likes to swap host processes > first, guest performance is decent, but host, not so much). > The Linux vm prefers anonymous memory, so guests do get an advantage. -- error compiling committee.c: too many arguments to function