From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjsNL-00016j-Qo for qemu-devel@nongnu.org; Tue, 04 Jun 2013 10:38:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjsNF-0007Uc-GW for qemu-devel@nongnu.org; Tue, 04 Jun 2013 10:38:15 -0400 Received: from mx.ipv6.kamp.de ([2a02:248:0:51::16]:53330 helo=mx01.kamp.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1UjsNF-0007UP-7q for qemu-devel@nongnu.org; Tue, 04 Jun 2013 10:38:09 -0400 Message-ID: <51ADFBCE.3080200@kamp.de> Date: Tue, 04 Jun 2013 16:38:06 +0200 From: Peter Lieven MIME-Version: 1.0 References: <51A7036A.3050407@ozlabs.ru> <51A7049F.6040207@redhat.com> <51A70B3D.90609@ozlabs.ru> <51A71705.6060009@kamp.de> <51A74D79.7040204@redhat.com> <2765FDFA-8050-4AA3-8621-7E9EA2C89F9C@kamp.de> <51A764FC.7080705@redhat.com> <51ADF122.70307@kamp.de> <51ADF637.7060804@redhat.com> In-Reply-To: <51ADF637.7060804@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] broken incoming migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Alexey Kardashevskiy , "qemu-ppc@nongnu.org" , "qemu-devel@nongnu.org" , David Gibson On 04.06.2013 16:14, Paolo Bonzini wrote: > Il 04/06/2013 15:52, Peter Lieven ha scritto: >> On 30.05.2013 16:41, Paolo Bonzini wrote: >>> Il 30/05/2013 16:38, Peter Lieven ha scritto: >>>>>> You could also scan the page for nonzero values before writing it. >>>> i had this in mind, but then choosed the other approach.... turned >>>> out to be a bad idea. >>>> >>>> alexey: i will prepare a patch later today, could you then please >>>> verify it fixes your problem. >>>> >>>> paolo: would we still need the madvise or is it enough to not write >>>> the zeroes? >>> It should be enough to not write them. >> Problem: checking the pages for zero allocates them. even at the source. > It doesn't look like. I tried this program and top doesn't show an > increasing amount of reserved memory: > > #include > #include > int main() > { > char *x = malloc(500 << 20); > int i, j; > for (i = 0; i < 500; i += 10) { > for (j = 0; j < 10 << 20; j += 4096) { > *(volatile char*) (x + (i << 20) + j); > } > getchar(); > } > } strange. we are talking about RSS size, right? is the malloc above using mmapped memory? which kernel version do you use? what avoids allocating the memory for me is the following (with whatever side effects it has ;-)) diff --git a/arch_init.c b/arch_init.c index 642f241..25d20a9 100644 --- a/arch_init.c +++ b/arch_init.c @@ -148,6 +148,10 @@ int qemu_read_default_config_files(bool userconfig) static inline bool is_zero_page(uint8_t *p) { + uint8_t ret; + if (mincore(p, TARGET_PAGE_SIZE, &ret) == 0 && !(ret&0x1)) { + return 1; + } return buffer_find_nonzero_offset(p, TARGET_PAGE_SIZE) == TARGET_PAGE_SIZE; } Peter > > Paolo -- Mit freundlichen Grüßen Peter Lieven ........................................................... KAMP Netzwerkdienste GmbH Vestische Str. 89-91 | 46117 Oberhausen Tel: +49 (0) 208.89 402-50 | Fax: +49 (0) 208.89 402-40 pl@kamp.de | http://www.kamp.de Geschäftsführer: Heiner Lante | Michael Lante Amtsgericht Duisburg | HRB Nr. 12154 USt-Id-Nr.: DE 120607556 ...........................................................