From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44112 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ow8JT-0000A2-HL for qemu-devel@nongnu.org; Thu, 16 Sep 2010 02:51:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ow8JS-00087M-E5 for qemu-devel@nongnu.org; Thu, 16 Sep 2010 02:51:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53992) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ow8JS-00087G-60 for qemu-devel@nongnu.org; Thu, 16 Sep 2010 02:51:18 -0400 Date: Thu, 16 Sep 2010 08:51:15 +0200 From: Gleb Natapov Subject: Re: [Qemu-devel] Re: [PATCH] add MADV_DONTFORK to guest physical memory Message-ID: <20100916065115.GS3008@redhat.com> References: <20100915170824.GL5981@random.random> <20100915210314.GB5526@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100915210314.GB5526@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Andrea Arcangeli , Anthony Liguori , qemu-devel@nongnu.org On Wed, Sep 15, 2010 at 11:03:14PM +0200, Michael S. Tsirkin wrote: > 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. > How it can be not a number of full host pages? This is guest memory. -- Gleb.