From: Stefan Hajnoczi <stefanha@redhat.com>
To: Yang Zhong <yang.zhong@intel.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, berrange@redhat.com,
zhaoshenglong@huawei.com, stone.xulei@huawei.com,
arei.gonglei@huawei.com, wangxinxin.wang@huawei.com,
weidong.huang@huawei.com, zhang.zhanghailiang@huawei.com,
liujunjie23@huawei.com
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 [thread overview]
Message-ID: <20171220160228.GD12566@stefanha-x1.localdomain> (raw)
In-Reply-To: <1513775806-19779-1-git-send-email-yang.zhong@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1286 bytes --]
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 <yang.zhong@intel.com>
> ---
> configure | 35 +++++++++++++++++++++++++++++++++++
> util/rcu.c | 6 ++++++
> 2 files changed, 41 insertions(+)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
prev parent reply other threads:[~2017-12-20 16:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-20 13:16 [Qemu-devel] [PATCH v4] rcu: reduce more than 7MB heap memory by malloc_trim() Yang Zhong
2017-12-20 16:02 ` Stefan Hajnoczi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171220160228.GD12566@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=berrange@redhat.com \
--cc=liujunjie23@huawei.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stone.xulei@huawei.com \
--cc=wangxinxin.wang@huawei.com \
--cc=weidong.huang@huawei.com \
--cc=yang.zhong@intel.com \
--cc=zhang.zhanghailiang@huawei.com \
--cc=zhaoshenglong@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).