On Wed, Jan 18, 2017 at 08:40:07PM +0800, Dou Liyang wrote: > 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 <douly.f...@cn.fujitsu.com>
Reviewed-by: Eduardo Habkost <ehabk...@redhat.com> Can be squashed in patch 1/3. > --- > 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 > > > -- Eduardo