diff mbox

preallocate memory after NUMA policy configuration

Message ID 20140509062452.GA29352@amt.cnet
State New
Headers show

Commit Message

Marcelo Tosatti May 9, 2014, 6:24 a.m. UTC
(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 <mtosatti@redhat.com>

Comments

Hu Tao May 9, 2014, 6:42 a.m. UTC | #1
On Fri, May 09, 2014 at 03:24:52AM -0300, Marcelo Tosatti wrote:
> 
> (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 <mtosatti@redhat.com>
> 
> 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 *

Thanks, I'll squash it in patch 25.

Regards,
Hu Tao
diff mbox

Patch

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 *