qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Memory: use memory address space for cpu-memory


From: Igor Mammedov
Subject: Re: [Qemu-devel] [PATCH] Memory: use memory address space for cpu-memory
Date: Wed, 17 May 2017 11:27:56 +0200

On Tue, 16 May 2017 15:15:23 -0700
Anthony Xu <address@hidden> wrote:

> If cpu-memory address space is same as memory address space,
> use memory address space for cpu-memory address space.
> 
> any memory region change causeaddress space to rebuild PhysPageMap,
> rebuilding PhysPageMap is very expensive.
> 
> removing cpu-memory address space reduces the guest boot time and
> memory usage.
> 
> Signed-off-by: Anthony Xu <address@hidden>
> ---
>  cpus.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 740b8dc..15c7a6a 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1748,8 +1748,13 @@ void qemu_init_vcpu(CPUState *cpu)
>          /* If the target cpu hasn't set up any address spaces itself,
>           * give it the default one.
>           */
> -        AddressSpace *as = address_space_init_shareable(cpu->memory,
> -                                                        "cpu-memory");
> +        AddressSpace *as;
> +        if (cpu->memory == address_space_memory.root) {
> +            address_space_memory.ref_count++;
probably this would cause reference leak when vcpu is destroyed

> +            as = &address_space_memory;
> +        } else {
> +            as = address_space_init_shareable(cpu->memory, "cpu-memory");
> +        }
>          cpu->num_ases = 1;
>          cpu_address_space_init(cpu, as, 0);
>      }




reply via email to

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