From mboxrd@z Thu Jan 1 00:00:00 1970 From: Izik Eidus Subject: Re: kvm userspace: ksm support Date: Tue, 28 Jul 2009 19:50:33 +0300 Message-ID: <4A6F2C59.8020306@redhat.com> References: <20090728193959.49cc28b6@woof.woof> <4A6F2A38.30500@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, "Justin M. Forbes" , Mark McLoughlin To: Anthony Liguori Return-path: Received: from mx2.redhat.com ([66.187.237.31]:35345 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754157AbZG1Qvu (ORCPT ); Tue, 28 Jul 2009 12:51:50 -0400 In-Reply-To: <4A6F2A38.30500@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: Anthony Liguori wrote: > Izik Eidus wrote: >> This patch is not for inclusion just rfc. >> > > The madvise() interface looks really nice :-) >> Thanks. >> >> >> From 1297b86aa257100b3d819df9f9f0932bf4f7f49d Mon Sep 17 00:00:00 2001 >> From: Izik Eidus >> Date: Tue, 28 Jul 2009 19:14:26 +0300 >> Subject: [PATCH] kvm userspace: ksm support >> >> rfc for ksm support to kvm userpsace. >> >> thanks >> >> Signed-off-by: Izik Eidus >> --- >> exec.c | 3 +++ >> 1 files changed, 3 insertions(+), 0 deletions(-) >> >> diff --git a/exec.c b/exec.c >> index f6d9ec9..375cc18 100644 >> --- a/exec.c >> +++ b/exec.c >> @@ -2595,6 +2595,9 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size) >> new_block->host = file_ram_alloc(size, mem_path); >> if (!new_block->host) { >> new_block->host = qemu_vmalloc(size); >> +#ifdef MADV_MERGEABLE >> + madvise(new_block->host, size, MADV_MERGEABLE); >> +#endif >> > > Are madvise calls additive? > > Do we need to change the madvise balloon calls to include > MADV_MERGEABLE or will this carry the property forever? You mean: when we later call for other madvise calls, if it will remove the MADV_MERGEABLE from that memory? if yes, the answer is no, it should be still l left in the vma->vm_flags... > > I'd suggest doing the following in osdep.h too: > > #if !defined(MADV_MERGABLE) > #define MADV_MERGABLE MADV_NORMAL > #endif > > To avoid #ifdefs in .c files. I tried to follow the way DONTFORK madvise is working... So you say, just to throw this thing into osdep.h instead of that c file? > > Regards, > > Anthony Liguori > >> } >> new_block->offset = last_ram_offset; >> new_block->length = size; >> >