[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4] rcu: reduce more than 7MB heap memory by mal
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v4] rcu: reduce more than 7MB heap memory by malloc_trim() |
Date: |
Wed, 20 Dec 2017 16:02:28 +0000 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Wed, Dec 20, 2017 at 09:16:46PM +0800, Yang Zhong wrote:
> Since there are some issues in memory alloc/free machenism
> in glibc for little chunk memory, if Qemu frequently
> alloc/free little chunk memory, the glibc doesn't alloc
> little chunk memory from free list of glibc and still
> allocate from OS, which make the heap size bigger and bigger.
>
> This patch introduce malloc_trim(), which will free heap
> memory when there is no rcu call during rcu thread loop.
> malloc_trim() can be enabled/disabled by --enable-malloc-trim/
> --disable-malloc-trim in the Qemu configure command. The
> default malloc_trim() is enabled for libc.
>
> Below are test results from smaps file.
> (1)without patch
> 55f0783e1000-55f07992a000 rw-p 00000000 00:00 0 [heap]
> Size: 21796 kB
> Rss: 14260 kB
> Pss: 14260 kB
>
> (2)with patch
> 55cc5fadf000-55cc61008000 rw-p 00000000 00:00 0 [heap]
> Size: 21668 kB
> Rss: 6940 kB
> Pss: 6940 kB
>
> Signed-off-by: Yang Zhong <address@hidden>
> ---
> configure | 35 +++++++++++++++++++++++++++++++++++
> util/rcu.c | 6 ++++++
> 2 files changed, 41 insertions(+)
Reviewed-by: Stefan Hajnoczi <address@hidden>
signature.asc
Description: PGP signature