[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3] memory: reduce heap Rss size around 3M
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v3] memory: reduce heap Rss size around 3M |
Date: |
Wed, 15 Mar 2017 09:12:31 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 15/03/2017 14:39, Yang Zhong wrote:
> Since cpu-memory and memory have same address space,one malloced
> memory is enough. This patch will skip memory malloc for memory
> address space,which will reduce around 3M physical memory in heap.
>
> Signed-off-by: Yang Zhong <address@hidden>
> ---
> memory.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/memory.c b/memory.c
> index 64b0a60..0003b1e 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -2422,7 +2422,7 @@ AddressSpace *address_space_init_shareable(MemoryRegion
> *root, const char *name)
> AddressSpace *as;
>
> QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
> - if (root == as->root && as->malloced) {
> + if (root == as->root && as == &address_space_memory) {
Of course you need to keep the as->malloced check, don't you?
> as->ref_count++;
> return as;
> }
>
This is not really beautiful, but compared to v1 and v2 it has the
advantage that it works (with the as->malloced check reintroduced).
Peter, you introduced address_space_init_shareable, what do you think?
Paolo