Received: from eggs.gnu.org ([2001:4830:134:3::10]:40972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT71r-0005XV-DR for qemu-devel@nongnu.org; Mon, 07 Oct 2013 05:23:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VT71m-0005rL-Ph for qemu-devel@nongnu.org; Mon, 07 Oct 2013 05:23:03 -0400 Received: from mx.ipv6.kamp.de ([2a02:248:0:51::16]:57113 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT71m-0005qv-Er for qemu-devel@nongnu.org; Mon, 07 Oct 2013 05:22:58 -0400 From: Peter Lieven Date: Mon, 7 Oct 2013 11:22:18 +0200 Message-Id: <1381137738-4231-1-git-send-email-pl@kamp.de> Subject: [Qemu-devel] [PATCH] migration: drop MADVISE_DONT_NEED for incoming zero pages List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, quintela@redhat.com, Peter Lieven , xiaoguangrong@linux.vnet.ibm.com 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 initalized (except for e.g. option roms and bios which are loaded into target memory altough 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 its called it is likely on a busy page (it was non-zero and changed to zero during migration) drop it completely. Signed-off-by: Peter Lieven Reported-By: Zhang Haoyu --- 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 } } -- 1.7.9.5