From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=57200 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvzEB-0004Vk-21 for qemu-devel@nongnu.org; Wed, 15 Sep 2010 17:09:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OvzE9-0003FL-IF for qemu-devel@nongnu.org; Wed, 15 Sep 2010 17:09:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56098) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvzE9-0003FF-8M for qemu-devel@nongnu.org; Wed, 15 Sep 2010 17:09:13 -0400 Date: Wed, 15 Sep 2010 23:03:14 +0200 From: "Michael S. Tsirkin" Message-ID: <20100915210314.GB5526@redhat.com> References: <20100915170824.GL5981@random.random> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100915170824.GL5981@random.random> Subject: [Qemu-devel] Re: [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: Andrea Arcangeli Cc: Anthony Liguori , qemu-devel@nongnu.org On Wed, Sep 15, 2010 at 07:08:24PM +0200, Andrea Arcangeli wrote: > 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 > } > } Is this always a number of full host pages? If not, we'd get trouble when trying to call helpers. -- MST