From: "Daniel P. Berrange" <berrange@redhat.com>
To: Yang Zhong <yang.zhong@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
zhaoshenglong@huawei.com, stefanha@redhat.com,
qemu-devel@nongnu.org, weidong.huang@huawei.com,
arei.gonglei@huawei.com, liujunjie23@huawei.com,
wangxinxin.wang@huawei.com, stone.xulei@huawei.com,
zhang.zhanghailiang@huawei.com
Subject: Re: [Qemu-devel] [PATCH v3] rcu: reduce more than 7MB heap memory by malloc_trim()
Date: Mon, 4 Dec 2017 12:07:05 +0000 [thread overview]
Message-ID: <20171204120705.GE20203@redhat.com> (raw)
In-Reply-To: <20171204120322.GA32151@yangzhon-Virtual>
On Mon, Dec 04, 2017 at 08:03:22PM +0800, Yang Zhong wrote:
> On Fri, Dec 01, 2017 at 01:52:49PM +0100, Paolo Bonzini wrote:
> > On 01/12/2017 11:56, Yang Zhong wrote:
> > > This issue should be caused by much times of system call by malloc_trim(),
> > > Shannon's test script include 60 scsi disks and 31 ioh3420 devices. We need
> > > trade-off between VM perforamance and memory optimization. Whether below
> > > method is suitable?
> > >
> > > int num=1;
> > > ......
> > >
> > > #if defined(CONFIG_MALLOC_TRIM)
> > > if(!(num++%5))
> > > {
> > > malloc_trim(4 * 1024 * 1024);
> > > }
> > > #endif
> > >
> > > Any comments are welcome! Thanks a lot!
> >
> > Indeed something like this will do, perhaps only trim once per second?
> >
> Hello Paolo,
>
> Thanks for comments!
> If we do trim once per second, maybe the frequency is a little high, what'e
> more, we need maintain one timer to call this, this also cost cpu resource.
>
> I added the log and did the test here with my test qemu command, when VM bootup,
> which did more than 600 times free operations and 9 times memory trim in rcu
> thread. If i use our ClearContainer qemu command, the memory trim will down
> to 6 times. As for Shannon's test command, the malloc trim number will abosultly
> increse.
>
> In my above method, the trim is only executed in the multiple of 5, which will
> reduce trim times and do not heavily impact VM bootup performance.
>
> I also want to use synchronize_rcu() and free() to replace call_rcu(), but this
> method serialize to malloc() and free(), which will reduce VM performance.
>
> The ultimate aim is to reduce trim system call during the VM bootup and running.
> It's appreciated that if you have better suggestions.
Does configuring QEMU to use tcmalloc or jemalloc instead of glibc's malloc
give you the performance & menmory usage that you require? If so, it might
not be worth bothering to hack around problems in glibc's malloc at all.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2017-12-04 12:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-24 6:30 [Qemu-devel] [PATCH v3] rcu: reduce more than 7MB heap memory by malloc_trim() Yang Zhong
2017-11-24 11:27 ` Stefan Hajnoczi
2017-11-26 6:17 ` Shannon Zhao
2017-11-27 3:06 ` Zhong Yang
2017-11-27 11:59 ` Paolo Bonzini
[not found] ` <20171201105622.GB26237@yangzhon-Virtual>
[not found] ` <74cccd14-e485-90d4-82d9-03355c05faca@redhat.com>
2017-12-04 12:03 ` Yang Zhong
2017-12-04 12:07 ` Daniel P. Berrange [this message]
2017-12-04 12:16 ` Yang Zhong
2017-12-04 12:18 ` Paolo Bonzini
2017-12-04 12:26 ` Shannon Zhao
2017-12-05 6:00 ` Yang Zhong
2017-12-05 14:10 ` Paolo Bonzini
2017-12-06 9:26 ` Yang Zhong
2017-12-06 9:48 ` Paolo Bonzini
2017-12-07 15:06 ` Yang Zhong
2017-12-11 16:31 ` Paolo Bonzini
2017-12-12 6:54 ` Yang Zhong
2017-12-12 7:09 ` Shannon Zhao
2017-12-18 7:17 ` Shannon Zhao
2017-12-18 7:51 ` Yang Zhong
2017-12-19 12:57 ` Paolo Bonzini
2017-12-08 11:06 ` Yang Zhong
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=20171204120705.GE20203@redhat.com \
--to=berrange@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=liujunjie23@huawei.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.