]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commit
exec: always use MADV_DONTFORK
authorAndrea Arcangeli <aarcange@redhat.com>
Thu, 25 Jul 2013 10:11:15 +0000 (12:11 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 25 Sep 2013 03:19:42 +0000 (22:19 -0500)
commit57ea2d21ae1863fd4002b2aea8ea8db8e206d464
treed9775d52ff2dcb2d315891d40a1cdef9ae4e8fcb
parent1cd7138d492304a76f3b8ae89fc61e05b18205a7
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@redhat.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
(cherry picked from commit 3e469dbfe413c25d48321c3a19ddfae0727dc6e5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
exec.c