From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37423 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvvTN-0002aG-PH for qemu-devel@nongnu.org; Wed, 15 Sep 2010 13:08:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OvvT9-0007TP-JA for qemu-devel@nongnu.org; Wed, 15 Sep 2010 13:08:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21613) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvvT9-0007T0-7x for qemu-devel@nongnu.org; Wed, 15 Sep 2010 13:08:27 -0400 Date: Wed, 15 Sep 2010 19:08:24 +0200 From: Andrea Arcangeli Message-ID: <20100915170824.GL5981@random.random> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] add MADV_DONTFORK to guest physical memory List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori From: Andrea Arcangeli All allocated guest physical memory shall be marked MADV_DONTFORK, otherwise fork will fail because of accounting issues preventing migration or netdev_add when the guest allocated more than half of host physical memory. Signed-off-by: Andrea Arcangeli --- diff --git a/exec.c b/exec.c index 380dab5..e2bdf19 100644 --- a/exec.c +++ b/exec.c @@ -2861,6 +2861,9 @@ ram_addr_t qemu_ram_alloc_from_ptr(DeviceState *dev, const char *name, #ifdef MADV_MERGEABLE madvise(new_block->host, size, MADV_MERGEABLE); #endif +#ifdef MADV_DONTFORK + madvise(new_block->host, size, MADV_DONTFORK); +#endif } }