]> git.proxmox.com Git - mirror_qemu.git/commitdiff
NUMA: Replace MAX_NODES with nb_numa_nodes in for loop
authorDou Liyang <douly.fnst@cn.fujitsu.com>
Tue, 22 Aug 2017 07:45:36 +0000 (15:45 +0800)
committerEduardo Habkost <ehabkost@redhat.com>
Tue, 19 Sep 2017 19:51:33 +0000 (16:51 -0300)
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>
numa.c

diff --git a/numa.c b/numa.c
index fe066ad2f8f4d60c20c8e311be49a5dde7ad32a3..100a67febffbc6b13b1664de55118e90799a70bc 100644 (file)
--- 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) {