From: Nolan Subject: Re: Live memory allocation? Date: Sat, 28 Mar 2009 18:25:52 +0000 (UTC) Message-ID: References: <49CB86BE.40505@poboxes.info> <49CB8B59.20601@redhat.com> <49CB8CF6.70403@wpkg.org> <200903280738.34169.alberto@byu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE To: kvm@vger.kernel.org Return-path: Received: from main.gmane.org ([80.91.229.2]:42600 "EHLO ciao.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753641AbZC1S0G (ORCPT ); Sat, 28 Mar 2009 14:26:06 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LndEJ-0002NS-8o for kvm@vger.kernel.org; Sat, 28 Mar 2009 18:26:03 +0000 Received: from c-71-202-202-194.hsd1.ca.comcast.net ([71.202.202.194]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 Mar 2009 18:26:03 +0000 Received: from nolan by c-71-202-202-194.hsd1.ca.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 Mar 2009 18:26:03 +0000 Sender: kvm-owner@vger.kernel.org List-ID: Alberto Trevi=C3=B1o byu.edu> writes: > The problem I've seen with this feature is that Windows guests end up= taking=20 > all of their available memory once they are up and running. For exam= ple,=20 > booting Windows XP in KVM 82 show a steady increase in memory. Then = about=20 > the time the login box is about to appear, memory usage jumps to the = maximum=20 > allowed to the VM (512 MB in this case). I remember reading somewher= e=20 > Windows would try to initialize all memory during boot, causing KVM t= o=20 > allocate all memory. VMware, however (and I don't know about Virtual= Box)=20 > knows about this and works around it, making sure memory isn't all al= located=20 > during the Windows boot process. Windows does zero all memory at boot, and also runs a idle-priority thr= ead in the background to zero memory as it is freed. This way it is far less = likely to need to zero a page to satisfy a memory allocation request. Whether or= not this is still a win now that people care about power consumption is an open = question. I suspect the difference of behavior between KVM and VMware is related = to VMware's page sharing. All those zeroed pages can be collapsed into on= e COW zero page. I wouldn't be surprised to learn that VMware has heuristics= in the page sharing code specifically for windows guests. Perhaps KSM would help you? Alternately, a heuristic that scanned for = (and collapsed) fully zeroed pages when a page is faulted in for the first t= ime could catch these.