Message ID | 20100915170824.GL5981@random.random |
---|---|
State | New |
Headers | show |
On 15.09.2010, at 19:08, Andrea Arcangeli wrote: > From: Andrea Arcangeli <aarcange@redhat.com> > > 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 <aarcange@redhat.com> The madvise logic is just about to get changed now. Please look at Andreas' patches and coordinate with him there. Alex
Am 15.09.2010 um 19:08 schrieb Andrea Arcangeli: > From: Andrea Arcangeli <aarcange@redhat.com> > > 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 <aarcange@redhat.com> > --- > > 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 There is a pending patch which introduces qemu_madvise() and will eliminate the need for these #ifdefs, which was demanded by Blue. I'll cc you on v6. Regards, Andreas
On Wed, Sep 15, 2010 at 07:08:24PM +0200, Andrea Arcangeli wrote: > From: Andrea Arcangeli <aarcange@redhat.com> > > 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 <aarcange@redhat.com> > --- > > 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.
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 <aarcange@redhat.com> > > > > 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 <aarcange@redhat.com> > > --- > > > > 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.
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 } }