qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/3] cpu: make the function of cpu_common_map_numa_n


From: Dou Liyang
Subject: [Qemu-devel] [PATCH 3/3] cpu: make the function of cpu_common_map_numa_node more efficiently
Date: Wed, 18 Jan 2017 20:40:07 +0800

Current function does some unnecessary operations, such as it makes
the assert() in the loop, and the loop was not stopped in time.

This patch moves the assert() out the loop and stops the loop in
time.

Signed-off-by: Dou Liyang <address@hidden>
---
 qom/cpu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qom/cpu.c b/qom/cpu.c
index e08dceb..3c655b2 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -343,10 +343,11 @@ static void cpu_common_map_numa_node(CPUState *cpu)
 {
     int i;
 
+    assert(cpu->cpu_index < max_cpus);
     for (i = 0; i < nb_numa_nodes; i++) {
-        assert(cpu->cpu_index < max_cpus);
         if (test_bit(cpu->cpu_index, numa_info[i].node_cpu)) {
             cpu->numa_node = i;
+            return;
         }
     }
 }
-- 
2.5.5






reply via email to

[Prev in Thread] Current Thread [Next in Thread]