From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFQzl-00029y-Ku for qemu-devel@nongnu.org; Fri, 30 Aug 2013 11:52:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VFQze-0000QK-B9 for qemu-devel@nongnu.org; Fri, 30 Aug 2013 11:52:21 -0400 Message-ID: <5220BFAA.4090300@suse.de> Date: Fri, 30 Aug 2013 17:52:10 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1374747075-7172-1-git-send-email-aarcange@redhat.com> <5201289C.4040809@redhat.com> <5220BEC1.5040908@redhat.com> In-Reply-To: <5220BEC1.5040908@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] PING^2 Re: [PATCH] KVM: always use MADV_DONTFORK List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Andrea Arcangeli , qemu-devel@nongnu.org, Gleb Natapov , qemu-stable@nongnu.org Am 30.08.2013 17:48, schrieb Paolo Bonzini: > Il 06/08/2013 18:47, Paolo Bonzini ha scritto: >> On 07/25/2013 12:11 PM, Andrea Arcangeli wrote: >>> 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 >>> --- >>> exec.c | 1 + >>> 1 file changed, 1 insertion(+) >>> >>> diff --git a/exec.c b/exec.c >>> index c99a883..d3bb58d 100644 >>> --- a/exec.c >>> +++ b/exec.c >>> @@ -1162,6 +1162,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); >>> >>> >> >> PING. >> >> Benoit reported this on IRC, too. >> >> Paolo >> >> >=20 > PING^2 >=20 > The last paragraph of the commit message should answer Andreas's object= ion. OK. The patch is mislabelled as "KVM:" though putting this in a common code path and touching exec.c only, so please put it on uq/master and fix that up before you set the history in stone. :) Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg