[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/13] exec: always use MADV_DONTFORK
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 01/13] exec: always use MADV_DONTFORK |
Date: |
Fri, 20 Sep 2013 18:24:40 +0200 |
From: Andrea Arcangeli <address@hidden>
MADV_DONTFORK prevents fork to fail with -ENOMEM if the default
overcommit heuristics decides there's too much anonymous virtual
memory allocated. If the KVM secondary MMU is synchronized with MMU
notifiers or not, doesn't make a difference in that regard.
Secondly it's always more efficient to avoid copying the guest
physical address space in the fork child (so we avoid to mark all the
guest memory readonly in the parent and so we skip the establishment
and teardown of lots of pagetables in the child).
In the common case we can ignore the error if MADV_DONTFORK is not
available. Leave a second invocation that errors out in the KVM path
if MMU notifiers are missing and KVM is enabled, to abort in such
case.
Signed-off-by: Andrea Arcangeli <address@hidden>
Tested-By: Benoit Canet <address@hidden>
Acked-by: Paolo Bonzini <address@hidden>
Signed-off-by: Gleb Natapov <address@hidden>
---
exec.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/exec.c b/exec.c
index 030118e..5e6015c 100644
--- a/exec.c
+++ b/exec.c
@@ -1157,6 +1157,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void
*host,
qemu_ram_setup_dump(new_block->host, size);
qemu_madvise(new_block->host, size, QEMU_MADV_HUGEPAGE);
+ qemu_madvise(new_block->host, size, QEMU_MADV_DONTFORK);
if (kvm_enabled())
kvm_setup_guest_memory(new_block->host, size);
--
1.8.3.1
- [Qemu-devel] [PULL 00/13] KVM patches for 2013-09-20, Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 02/13] cpu: Move cpu state syncs up into cpu_dump_state(), Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 01/13] exec: always use MADV_DONTFORK,
Paolo Bonzini <=
- [Qemu-devel] [PULL 06/13] kvmvapic: Catch invalid ROM size, Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 07/13] kvmvapic: Enter inactive state on hardware reset, Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 05/13] kvm irqfd: support direct msimessage to irq translation, Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 03/13] kvm: warn if num cpus is greater than num recommended, Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 04/13] fix steal time MSR vmsd callback to proper opaque type, Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 08/13] kvmvapic: Clear also physical ROM address when entering INACTIVE state, Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 09/13] kvm: fix traces to use %x instead of %d, Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 10/13] linux-headers: update to 3.11, Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 11/13] target-i386: forward CPUID cache leaves when -cpu host is used, Paolo Bonzini, 2013/09/20
- [Qemu-devel] [PULL 13/13] target-i386: add feature kvm_pv_unhalt, Paolo Bonzini, 2013/09/20