qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Cc: quintela@redhat.com, aik@ozlabs.ru, qemu-devel@nongnu.org,
	owasserm@redhat.com, pbonzini@redhat.com,
	david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [PATCHv2 2/2] migration: do not overwrite zero pages
Date: Thu, 13 Jun 2013 08:21:24 +0200	[thread overview]
Message-ID: <51B964E4.1020504@kamp.de> (raw)
In-Reply-To: <51B93CBE.4040403@linux.vnet.ibm.com>

On 13.06.2013 05:30, Wenchao Xia wrote:
> 于 2013-6-10 18:14, Peter Lieven 写道:
>> 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 08fccf6..cf4e1d5 100644
>> --- a/arch_init.c
>> +++ b/arch_init.c
>> @@ -832,14 +832,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)) {
>   If incoming page is not zero, always memset. If incoming page is
> zero, then if on destination it is not zero, memset. Logic is OK.
> Only question is if the read operation in is_zero_page() consumes
> memory, as there are doubt in the discuss before.

It does not consume memory for normal pages and for thp since 3.8.

BR,
Peter

      reply	other threads:[~2013-06-13  6:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 10:14 [Qemu-devel] [PATCHv2 0/2] fix migration of zero pages Peter Lieven
2013-06-10 10:14 ` [Qemu-devel] [PATCHv2 1/2] Revert "migration: do not sent zero pages in bulk stage" Peter Lieven
2013-06-10 15:42   ` mdroth
2013-06-10 17:08   ` Orit Wasserman
2013-06-13  2:45   ` Wenchao Xia
2013-06-10 10:14 ` [Qemu-devel] [PATCHv2 2/2] migration: do not overwrite zero pages Peter Lieven
2013-06-10 16:10   ` mdroth
2013-06-10 16:17     ` mdroth
2013-06-10 18:50     ` Peter Lieven
2013-06-10 17:13   ` Orit Wasserman
2013-06-13  3:30   ` Wenchao Xia
2013-06-13  6:21     ` Peter Lieven [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=51B964E4.1020504@kamp.de \
    --to=pl@kamp.de \
    --cc=aik@ozlabs.ru \
    --cc=david@gibson.dropbear.id.au \
    --cc=owasserm@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=xiawenc@linux.vnet.ibm.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).