qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] add MADV_DONTFORK to guest physical memory


From: Andrea Arcangeli
Subject: Re: [Qemu-devel] [PATCH] add MADV_DONTFORK to guest physical memory
Date: Wed, 5 Jan 2011 16:10:12 +0100

The bug is still there so I rediffed the old patch against current
code.

On a related topic: could somebody give me advice on how to implement
a command line (command line seems enough, the other option would be
monitor command) to make the MADV_MERGEABLE conditional? I got KSM on
THP working fine but KSM may decrease performance by increasing the
number of copy on write and by splitting hugepages, so we'd like to be
able to turn off KSM on a per-VM basis (not on the whole host, which
of course we already can by setting /sys/kernel/mm/ksm/run to 0) so
that high perf VMs will keep running at maximum speed with KSM off but
others may still benefit from KSM. For that I need to make the below
MADV_MERGEABLE madvise conditional to something and the code itself
will be trivial, we've just to converge on a command line option
(hopefully quickly ;).

======
Subject: avoid allocation failures during fork/exec for migrate/hotplug

From: Andrea Arcangeli <address@hidden>

Mark all guest physical memory as MADV_DONTFORK to avoid false positive
allocation failures during fork in migrate/netdev hotplug.

Signed-off-by: Andrea Arcangeli <address@hidden>
---

diff --git a/exec.c b/exec.c
index db9ff55..9e2aa12 100644
--- a/exec.c
+++ b/exec.c
@@ -2851,6 +2851,9 @@ ram_addr_t qemu_ram_alloc_from_ptr(DeviceState *dev, 
const char *name,
             new_block->host = qemu_vmalloc(size);
 #endif
             qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE);
+
+            /* no allocation failures during fork/exec for migrate/hotplug */
+            qemu_madvise(new_block->host, size, QEMU_MADV_DONTFORK);
         }
     }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]