From: Dou Liyang Date: Tue, 22 Aug 2017 07:45:36 +0000 (+0800) Subject: NUMA: Replace MAX_NODES with nb_numa_nodes in for loop X-Git-Tag: qemu-xen-4.11.0-rc1~163^2~2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f51878ba863d1f6938bc8e04381979767b7b508c;p=qemu-xen.git NUMA: Replace MAX_NODES with nb_numa_nodes in for loop In QEMU, the number of the NUMA nodes is determined by parse_numa_opts(). Then, QEMU uses it for iteration, for example: for (i = 0; i < nb_numa_nodes; i++) However, in memory_region_allocate_system_memory(), it uses MAX_NODES not nb_numa_nodes. So, replace MAX_NODES with nb_numa_nodes to keep code consistency and reduce the loop times. Signed-off-by: Dou Liyang Message-Id: <1503387936-3483-1-git-send-email-douly.fnst@cn.fujitsu.com> Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Eduardo Habkost --- diff --git a/numa.c b/numa.c index fe066ad2f8..100a67febf 100644 --- a/numa.c +++ b/numa.c @@ -567,7 +567,7 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, } memory_region_init(mr, owner, name, ram_size); - for (i = 0; i < MAX_NODES; i++) { + for (i = 0; i < nb_numa_nodes; i++) { uint64_t size = numa_info[i].node_mem; HostMemoryBackend *backend = numa_info[i].node_memdev; if (!backend) {