From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNhvE-0004lE-3k for qemu-devel@nongnu.org; Thu, 14 Jul 2016 10:47:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNhvA-0000X2-2D for qemu-devel@nongnu.org; Thu, 14 Jul 2016 10:47:28 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:58611 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNhv9-0000W5-Oa for qemu-devel@nongnu.org; Thu, 14 Jul 2016 10:47:23 -0400 References: <1467104499-27517-1-git-send-email-pl@kamp.de> <1467104499-27517-14-git-send-email-pl@kamp.de> <57836783.4070100@kamp.de> <36988a72-e656-e65e-753f-1cc5411ac7ac@redhat.com> <5784FFEF.8020407@kamp.de> From: Peter Lieven Message-ID: <5787A5F0.6010501@kamp.de> Date: Thu, 14 Jul 2016 16:47:12 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 13/15] exec: use mmap for PhysPageMap->nodes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: kwolf@redhat.com, peter.maydell@linaro.org, mst@redhat.com, dgilbert@redhat.com, mreitz@redhat.com, kraxel@redhat.com Am 13.07.2016 um 12:27 schrieb Paolo Bonzini: > > On 12/07/2016 16:34, Peter Lieven wrote: >> Am 11.07.2016 um 12:37 schrieb Paolo Bonzini: >>> On 11/07/2016 11:31, Peter Lieven wrote: >>>> Am 28.06.2016 um 12:43 schrieb Paolo Bonzini: >>>>> On 28/06/2016 11:01, Peter Lieven wrote: >>>>>> this was causing serious framentation in conjunction with the >>>>>> subpages since RCU was introduced. The node space was allocated >>>>>> at approx 32kB then reallocted to approx 75kB and this a few hundred >>>>>> times at startup. And thanks to RCU the freeing was delayed. >>>>>> >>>>>> Signed-off-by: Peter Lieven >>>>> The size of the node from the previous as->dispatch could be used as a >>>>> hint for the new one perhaps, avoiding the reallocation? >>>> This here seems also to work: >>>> >>>> diff --git a/exec.c b/exec.c >>>> index 0122ef7..2691c0a 100644 >>>> --- a/exec.c >>>> +++ b/exec.c >>>> @@ -187,10 +187,12 @@ struct CPUAddressSpace { >>>> >>>> static void phys_map_node_reserve(PhysPageMap *map, unsigned nodes) >>>> { >>>> + static unsigned alloc_hint = 16; >>>> if (map->nodes_nb + nodes > map->nodes_nb_alloc) { >>>> - map->nodes_nb_alloc = MAX(map->nodes_nb_alloc * 2, 16); >>>> + map->nodes_nb_alloc = MAX(map->nodes_nb_alloc, alloc_hint); >>>> map->nodes_nb_alloc = MAX(map->nodes_nb_alloc, map->nodes_nb + >>>> nodes); >>>> map->nodes = g_renew(Node, map->nodes, map->nodes_nb_alloc); >>>> + alloc_hint = map->nodes_nb_alloc; >>>> } >>>> } >>>> >>>> >>>> Question is still, mmap for this? >>> Nice! Can you submit a patch for this? >> Of course, but please see my other comment. We still should consider mmap for this cause we have close to 500 Physmaps about 70KB each which >> are all allocted at the same time - I think due to RCU. > That I think is not material for 2.7, and also I want to take a look at > creating nodes lazily. Okay, then I will send a patch to avoid the realloc and we look at this later. Peter > > Paolo -- Mit freundlichen Grüßen Peter Lieven ........................................................... KAMP Netzwerkdienste GmbH Vestische Str. 89-91 | 46117 Oberhausen Tel: +49 (0) 208.89 402-50 | Fax: +49 (0) 208.89 402-40 pl@kamp.de | http://www.kamp.de Geschäftsführer: Heiner Lante | Michael Lante Amtsgericht Duisburg | HRB Nr. 12154 USt-Id-Nr.: DE 120607556 ...........................................................