From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WieG0-0005lo-GU for qemu-devel@nongnu.org; Fri, 09 May 2014 02:26:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WieFq-0003Vs-RI for qemu-devel@nongnu.org; Fri, 09 May 2014 02:26:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20320) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WieFq-0003Vf-JX for qemu-devel@nongnu.org; Fri, 09 May 2014 02:25:58 -0400 Date: Fri, 9 May 2014 03:24:52 -0300 From: Marcelo Tosatti Message-ID: <20140509062452.GA29352@amt.cnet> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCH] preallocate memory after NUMA policy configuration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: Paolo Bonzini , qemu-devel@nongnu.org, Igor Mammedov (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 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 *