[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] cpu: make the function of cpu_common_map_nu
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] cpu: make the function of cpu_common_map_numa_node more efficiently |
Date: |
Wed, 18 Jan 2017 10:56:57 -0200 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
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 <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
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