NUMA: Replace MAX_NODES with nb_numa_nodes in for loop
PATCH 1/1 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.
--- numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
numa.c +1 -1
@@ -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) {
Signature · 1 line
2.5.5
Quoted 11 lines · On Tue, 22 Aug 2017 15:45:36 +0800 Dou Liyang <[email protected]> wrote:
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 usesMAX_NODESnotnb_numa_nodes.So, replace
MAX_NODESwithnb_numa_nodesto keep code consistency and reduce the loop times.Signed-off-by Dou Liyang <[email protected]>
Quoted 17 lines
--- numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)numa.c +1
-1@@ -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) {
Philippe Mathieu-Daudé
Reviewed-byQuoted 7 lines · Igor Mammedov
Quoted 4 lines · On Tue, 22 Aug 2017 15:45:36 +0800 Dou Liyang <[email protected]> wrote:
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++)
Quoted 8 lines
Quoted 7 lines
However, in
memory_region_allocate_system_memory(), it usesMAX_NODESnotnb_numa_nodes.So, replace
MAX_NODESwithnb_numa_nodesto keep code consistency and reduce the loop times.Signed-off-by Dou Liyang <[email protected]>Reviewed-by Igor Mammedov <[email protected]>
Quoted 20 lines
Quoted 18 lines
--- numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)numa.c +1
-1@@ -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) {