From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomasz Chmielewski Subject: Re: Live memory allocation? Date: Mon, 30 Mar 2009 15:40:26 +0200 Message-ID: <49D0CBCA.3000808@wpkg.org> References: <49CB86BE.40505@poboxes.info> <49CB8B59.20601@redhat.com> <49CB8CF6.70403@wpkg.org> <200903280738.34169.alberto@byu.edu> <49CF6AA4.2060108@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Nolan , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx03.syneticon.net ([78.111.66.105]:55501 "EHLO mx03.syneticon.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751020AbZC3Nkc (ORCPT ); Mon, 30 Mar 2009 09:40:32 -0400 In-Reply-To: <49CF6AA4.2060108@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity schrieb: (...) >> 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). From KSM description I can conclude that it "allows dynamicly sharing identical memory pages between one or more processes". What about cache/buffers sharing between the host kernel and running processes? If I'm not mistaken, right now, memory is "wasted" by caching the same data by host and guest kernels. For example, let's say we have a host with 2 GB RAM and it runs a 1 GB guest. If we read ~900 MB file_1 (block device) on guest, then: - guest's kernel will cache file_1 - host's kernel will cache the same area of file_1 (block device) Now, if we want to read ~900 MB file_2 (or lots of files with that size), cache for file_1 will be emptied on both guest and host as we read file_2. Ideal situation would be if host and guest caches could be "shared", to a degree (and have both file_1 and file_2 in memory, doesn't matter if it's guest or host). -- Tomasz Chmielewski http://wpkg.org