From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZGtW-00005E-Bx for qemu-devel@nongnu.org; Thu, 24 Oct 2013 05:07:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZGtR-0002KE-3n for qemu-devel@nongnu.org; Thu, 24 Oct 2013 05:07:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZGtQ-0002K1-Sj for qemu-devel@nongnu.org; Thu, 24 Oct 2013 05:07:49 -0400 From: Juan Quintela In-Reply-To: <1382599289-9503-1-git-send-email-pl@kamp.de> (Peter Lieven's message of "Thu, 24 Oct 2013 09:21:29 +0200") References: <1382599289-9503-1-git-send-email-pl@kamp.de> Date: Thu, 24 Oct 2013 11:07:38 +0100 Message-ID: <87d2mvouc5.fsf@elfo.elfo> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [RESEND][PATCH] migration: drop MADVISE_DONT_NEED for incoming zero pages Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: pbonzini@redhat.com, haoyu.zhang@huawei.com, qemu-devel@nongnu.org, afaerber@suse.de, xiaoguangrong@linux.vnet.ibm.com Peter Lieven wrote: > The madvise for zeroed out pages was introduced when every transferred > zero page was memset to zero and thus allocated. Since commit > 211ea740 we check for zeroness of a target page before we memset > it to zero. Additionally we memmap target memory so it is essentially > zero initialized (except for e.g. option roms and bios which are loaded > into target memory although they shouldn't). > > It was reported recently that this madvise causes a performance degradation > in some situations. As the madvise should only be called rarely and if it's called > it is likely on a busy page (it was non-zero and changed to zero during migration) > drop it completely. Reviewed-by: Juan Quintela I take it. I am on KVM Forum/LinuxCon this week. Will send when back at home. Thanks. > > Reported-By: Zhang Haoyu > Acked-by: Paolo Bonzini > Signed-off-by: Peter Lieven > --- > arch_init.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/arch_init.c b/arch_init.c > index 7545d96..e0acbc5 100644 > --- a/arch_init.c > +++ b/arch_init.c > @@ -850,14 +850,6 @@ void ram_handle_compressed(void *host, uint8_t ch, uint64_t size) > { > if (ch != 0 || !is_zero_range(host, size)) { > memset(host, ch, size); > -#ifndef _WIN32 > - if (ch == 0 && (!kvm_enabled() || kvm_has_sync_mmu())) { > - size = size & ~(getpagesize() - 1); > - if (size > 0) { > - qemu_madvise(host, size, QEMU_MADV_DONTNEED); > - } > - } > -#endif > } > }