qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 13/15] exec: use mmap for PhysPageMap->nodes


From: Peter Lieven
Subject: Re: [Qemu-devel] [PATCH 13/15] exec: use mmap for PhysPageMap->nodes
Date: Mon, 11 Jul 2016 11:31:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

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 <address@hidden>
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?

Peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]