qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] preallocate memory after NUMA policy configuration


From: Marcelo Tosatti
Subject: [Qemu-devel] [PATCH] preallocate memory after NUMA policy configuration
Date: Fri, 9 May 2014 03:24:52 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

(note: applies on top of patchset of current thread)

Preallocate memory after the NUMA policy has been instantiated.
This is necessary to guarantee memory is allocated with 
specified NUMA policy in place.

Signed-off-by: Marcelo Tosatti <address@hidden>

diff --git a/backends/hostmem.c b/backends/hostmem.c
index d3f8476..3cfa8a0 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -293,9 +293,6 @@ host_memory_backend_memory_init(UserCreatable *uc, Error 
**errp)
     if (!backend->dump) {
         qemu_madvise(ptr, sz, QEMU_MADV_DONTDUMP);
     }
-    if (backend->prealloc) {
-        os_mem_prealloc(memory_region_get_fd(&backend->mr), ptr, sz);
-    }
 
 #ifdef CONFIG_NUMA
     unsigned long maxnode = find_last_bit(backend->host_nodes, MAX_NODES);
@@ -310,6 +307,9 @@ host_memory_backend_memory_init(UserCreatable *uc, Error 
**errp)
         return;
     }
 #endif
+    if (backend->prealloc) {
+        os_mem_prealloc(memory_region_get_fd(&backend->mr), ptr, sz);
+    }
 }
 
 MemoryRegion *



reply via email to

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