Skip to content

Commit

Permalink
NUMA: Replace MAX_NODES with nb_numa_nodes in for loop
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
douliyang authored and ehabkost committed Sep 19, 2017
1 parent 79e0793 commit f51878b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion numa.c
Expand Up @@ -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) {
Expand Down

0 comments on commit f51878b

Please sign in to comment.