From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Lieven <pl@dlhnet.de>
Cc: Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
Orit Wasserman <owasserm@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [RFC] optimize is_dup_page for zero pages
Date: Tue, 12 Mar 2013 12:46:07 +0100 [thread overview]
Message-ID: <513F157F.2010000@redhat.com> (raw)
In-Reply-To: <7E550AE8-25FC-4765-B75E-18DE70728616@dlhnet.de>
Il 12/03/2013 12:20, Peter Lieven ha scritto:
>> * zero pages remain zero, and thus are only processed once
>
> you are right this will be the case.
>
>>
>> * non-zero pages are modified often, and thus are processed multiple times.
>>
>> Your patch adds overhead in the case where a page is non-zero, which
>> will be the common case in any non-artificial benchmark. It _is_
>> possible that the net result is positive because you warm the cache with
>> the first 128 bytes of the page. But without more benchmarking, it is
>> reasonable to optimize is_dup_page for the case where the for loop rolls
>> very few times.
>
> Ok, good point. However, it will only enter the zero check if the first byte (or maybe could change
> this to first 32 or 64 bit) is zero.
On big-endian architectures, I expect that the first byte will be zero
very often. (32- or 64-bit, much less indeed).
> What about using this patch for buffer_is_zero optimization?
buffer_is_zero is used in somewhat special cases (block
streaming/copy-on-read) where throughput doesn't really matter, unlike
is_dup_page/find_zero_bit which are used in migration. But you can use
similar code for is_dup_page and buffer_is_zero.
BTW, I would like to change is_dup_page to is_zero_page. Non-zero pages
with a repeated value are virtually non-existent, and perhaps we can
improve the migration format by packing multiple pages (up to 64) in a
single "chunk" (i.e. a small header followed by up to 256K bytes of
data). I would like to see Orit's patches to optimize RAM migration
first, since this only makes sense after you remove all userspace
copies. Otherwise, the cost of copying the 4k of data to a buffer will
dominate almost every optimization you can make.
Paolo
next prev parent reply other threads:[~2013-03-12 11:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-12 10:51 [Qemu-devel] [RFC] optimize is_dup_page for zero pages Peter Lieven
2013-03-12 11:11 ` Paolo Bonzini
2013-03-12 11:20 ` Peter Lieven
2013-03-12 11:46 ` Paolo Bonzini [this message]
2013-03-12 11:51 ` Peter Lieven
2013-03-12 12:02 ` Paolo Bonzini
2013-03-12 12:15 ` Peter Lieven
2013-03-12 20:10 ` Peter Lieven
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=513F157F.2010000@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=owasserm@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pl@dlhnet.de \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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.