From: "Michael R. Hines" <mrhines@linux.vnet.ibm.com>
To: Isaku Yamahata <yamahata@private.email.ne.jp>
Cc: owasserm@redhat.com, quintela@redhat.com, mrhines@us.ibm.com,
qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] migration: ram_handle_compressed
Date: Fri, 20 Sep 2013 10:09:02 -0400 [thread overview]
Message-ID: <523C56FE.7090303@linux.vnet.ibm.com> (raw)
In-Reply-To: <37844bd5ee04e7d9ba3dab8f06bdedc39c46c8f1.1379663427.git.yamahata@private.email.ne.jp>
On 09/20/2013 03:51 AM, Isaku Yamahata wrote:
> ram_handle_compressed() should be aware of size > TARGET_PAGE_SIZE.
> migration-rdma can call it with larger size.
>
> Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
> ---
> changes v1 -> v2:
> - don't loop
> ---
> arch_init.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index e47e139..ab466fc 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -844,13 +844,14 @@ static inline void *host_from_stream_offset(QEMUFile *f,
> */
> void ram_handle_compressed(void *host, uint8_t ch, uint64_t size)
> {
> - if (ch != 0 || !is_zero_page(host)) {
> + if (ch != 0 || buffer_find_nonzero_offset(host, size) != size) {
> memset(host, ch, size);
> #ifndef _WIN32
> - if (ch == 0 &&
> - (!kvm_enabled() || kvm_has_sync_mmu()) &&
> - getpagesize() <= TARGET_PAGE_SIZE) {
> - qemu_madvise(host, TARGET_PAGE_SIZE, QEMU_MADV_DONTNEED);
> + if (ch == 0 && (!kvm_enabled() || kvm_has_sync_mmu())) {
> + size = size & ~(getpagesize() - 1);
> + if (size > 0) {
> + qemu_madvise(host, size, QEMU_MADV_DONTNEED);
> + }
> }
> #endif
> }
NACK.
Why don't you modify the is_zero_page function *itself*?
This seems like an overly complicated solution - just modify the
is_zero_page function to pass along the size parameter and let
buffer_find_nonzero_offset() run the same code.
Fix the original problem - don't breakup the memory into smaller
pieces.....
- Michael
prev parent reply other threads:[~2013-09-20 14:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-20 7:51 [Qemu-devel] [PATCH v2] migration: ram_handle_compressed Isaku Yamahata
2013-09-20 14:09 ` Michael R. Hines [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=523C56FE.7090303@linux.vnet.ibm.com \
--to=mrhines@linux.vnet.ibm.com \
--cc=mrhines@us.ibm.com \
--cc=owasserm@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=yamahata@private.email.ne.jp \
/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.