qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Lieven <pl@kamp.de>, qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] migration: do not overwrite zero pages
Date: Tue, 25 Jun 2013 00:59:51 +1000	[thread overview]
Message-ID: <51C85EE7.3090103@ozlabs.ru> (raw)
In-Reply-To: <51C183B0.7010909@redhat.com>

On 06/19/2013 08:10 PM, Paolo Bonzini wrote:
> Il 06/06/2013 10:36, Peter Lieven ha scritto:
>> on incoming migration do not memset pages to zero if they already read as zero.
>> this will allocate a new zero page and consume memory unnecessarily. even
>> if we madvise a MADV_DONTNEED later this will only deallocate the memory
>> asynchronously.
>>
>> Signed-off-by: Peter Lieven <pl@kamp.de>
>> ---
>>  arch_init.c |   14 ++++++++------
>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch_init.c b/arch_init.c
>> index 283081d..642f241 100644
>> --- a/arch_init.c
>> +++ b/arch_init.c
>> @@ -821,14 +821,16 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
>>              }
>>  
>>              ch = qemu_get_byte(f);
>> -            memset(host, ch, TARGET_PAGE_SIZE);
>> +            if (ch != 0 || !is_zero_page(host)) {
>> +                memset(host, ch, TARGET_PAGE_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()) &&
>> +                    getpagesize() <= TARGET_PAGE_SIZE) {
>> +                    qemu_madvise(host, TARGET_PAGE_SIZE, QEMU_MADV_DONTNEED);
>> +                }
>>  #endif
>> +            }
>>          } else if (flags & RAM_SAVE_FLAG_PAGE) {
>>              void *host;
>>  
>>
> 
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Is it expected to reach upstream any time soon? Thanks.



-- 
Alexey

      reply	other threads:[~2013-06-24 15:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-06  8:36 [Qemu-devel] [PATCH 0/2] fix migration of zero pages Peter Lieven
2013-06-06  8:36 ` [Qemu-devel] [PATCH 1/2] Revert "migration: do not sent zero pages in bulk stage" Peter Lieven
2013-06-06 12:16   ` Eric Blake
2013-06-06 14:26     ` Peter Lieven
2013-06-15 15:28       ` Eric Blake
2013-06-19 10:10   ` Paolo Bonzini
2013-06-06  8:36 ` [Qemu-devel] [PATCH 2/2] migration: do not overwrite zero pages Peter Lieven
2013-06-19 10:10   ` Paolo Bonzini
2013-06-24 14:59     ` Alexey Kardashevskiy [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=51C85EE7.3090103@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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).