From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Live memory allocation? Date: Sun, 29 Mar 2009 15:33:40 +0300 Message-ID: <49CF6AA4.2060108@redhat.com> 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; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Nolan Return-path: Received: from mx2.redhat.com ([66.187.237.31]:40596 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751137AbZC2Mdp (ORCPT ); Sun, 29 Mar 2009 08:33:45 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Nolan wrote: > Windows does zero all memory at boot, and also runs a idle-priority thread 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 one 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 time could > catch these. > ksm will indeed collapse these pages. Lighter-weight alternatives exist -- ballooning (need a Windows driver), or, like you mention, a simple scanner that looks for zero pages and drops them. That could be implemented within qemu (with some simple kernel support for dropping zero pages atomically, say madvise(MADV_DROP_IFZERO). -- error compiling committee.c: too many arguments to function