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

[Xen-changelog] [qemu-upstream-unstable] exec: always use MADV_DONTFORK



commit 57ea2d21ae1863fd4002b2aea8ea8db8e206d464
Author:     Andrea Arcangeli <aarcange@xxxxxxxxxx>
AuthorDate: Thu Jul 25 12:11:15 2013 +0200
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Tue Sep 24 22:19:42 2013 -0500

    exec: always use MADV_DONTFORK
    
    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 <aarcange@xxxxxxxxxx>
    Tested-By: Benoit Canet <benoit@xxxxxxxxxxx>
    Acked-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    Signed-off-by: Gleb Natapov <gleb@xxxxxxxxxx>
    (cherry picked from commit 3e469dbfe413c25d48321c3a19ddfae0727dc6e5)
    
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 exec.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/exec.c b/exec.c
index 394f7e2..2ea8f04 100644
--- a/exec.c
+++ b/exec.c
@@ -1172,6 +1172,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);
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.