From: Andrea Arcangeli <aarca...@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 <aarca...@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
         }
     }
 

Reply via email to