aboutsummaryrefslogtreecommitdiff
path: root/numa.c
diff options
context:
space:
mode:
authorDou Liyang <douly.fnst@cn.fujitsu.com>2017-08-22 15:45:36 +0800
committerEduardo Habkost <ehabkost@redhat.com>2017-09-19 16:51:33 -0300
commitf51878ba863d1f6938bc8e04381979767b7b508c (patch)
tree48b31fa8b150b9a980f99a98d1460f2e92b53939 /numa.c
parent79e0793614fcd6b5674fa96180b66971c37d1dfd (diff)
downloadqemu-f51878ba863d1f6938bc8e04381979767b7b508c.zip
qemu-f51878ba863d1f6938bc8e04381979767b7b508c.tar.gz
qemu-f51878ba863d1f6938bc8e04381979767b7b508c.tar.bz2
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 <douly.fnst@cn.fujitsu.com> Message-Id: <1503387936-3483-1-git-send-email-douly.fnst@cn.fujitsu.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'numa.c')
-rw-r--r--numa.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numa.c b/numa.c
index fe066ad..100a67f 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) {