From: Paolo Bonzini <pbonzini@redhat.com>
To: Gonglei <arei.gonglei@huawei.com>, qemu-devel@nongnu.org
Cc: peter.huangpeng@huawei.com
Subject: Re: [Qemu-devel] [PATCH 0/3] memory: an optimization
Date: Sat, 20 Feb 2016 10:47:36 +0100 [thread overview]
Message-ID: <56C83638.2010406@redhat.com> (raw)
In-Reply-To: <1455935721-8804-1-git-send-email-arei.gonglei@huawei.com>
On 20/02/2016 03:35, Gonglei wrote:
> Perf top tells me qemu_get_ram_ptr consume too much cpu cycles.
>> 22.56% qemu-kvm [.] address_space_translate
>> 13.29% qemu-kvm [.] qemu_get_ram_ptr
>> 4.71% qemu-kvm [.] phys_page_find
>> 4.43% qemu-kvm [.] address_space_translate_internal
>> 3.47% libpthread-2.19.so [.] __pthread_mutex_unlock_usercnt
>> 3.08% qemu-kvm [.] qemu_ram_addr_from_host
>> 2.62% qemu-kvm [.] address_space_map
>> 2.61% libc-2.19.so [.] _int_malloc
>> 2.58% libc-2.19.so [.] _int_free
>> 2.38% libc-2.19.so [.] malloc
>> 2.06% libpthread-2.19.so [.] pthread_mutex_lock
>> 1.68% libc-2.19.so [.] malloc_consolidate
>> 1.35% libc-2.19.so [.] __memcpy_sse2_unaligned
>> 1.23% qemu-kvm [.] lduw_le_phys
>> 1.18% qemu-kvm [.] find_next_zero_bit
>> 1.02% qemu-kvm [.] object_unref
>
> And Paolo suggested that we can get rid of qemu_get_ram_ptr
> by storing the RAMBlock pointer into the memory region,
> instead of the ram_addr_t value. And after appling this change,
> I got much better performance indeed.
What's the gain like?
I've not reviewed the patch in depth, but what I can say is that I like
it a lot. It only does the bare minimum needed to provide the
optimization, but this also makes it very simple to understand. More
cleanups and further optimizations are possible (including removing
mr->ram_addr completely), but your patches really does one thing and
does it well. Good job!
Paolo
next prev parent reply other threads:[~2016-02-20 9:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-20 2:35 [Qemu-devel] [PATCH 0/3] memory: an optimization Gonglei
2016-02-20 2:35 ` [Qemu-devel] [PATCH 1/3] exec: store RAMBlock pointer into memory region Gonglei
2016-02-22 2:45 ` Fam Zheng
2016-02-22 3:28 ` Gonglei (Arei)
2016-02-20 2:35 ` [Qemu-devel] [PATCH 2/3] memory: optimize qemu_get_ram_ptr and qemu_ram_ptr_length Gonglei
2016-02-20 2:35 ` [Qemu-devel] [PATCH 3/3] memory: Remove the superfluous code Gonglei
2016-02-20 9:47 ` Paolo Bonzini [this message]
2016-02-20 10:34 ` [Qemu-devel] [PATCH 0/3] memory: an optimization Gonglei (Arei)
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=56C83638.2010406@redhat.com \
--to=pbonzini@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
/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).