From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI0T2-0004fl-20 for qemu-devel@nongnu.org; Tue, 19 Mar 2013 13:37:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UI0T0-0000d2-0q for qemu-devel@nongnu.org; Tue, 19 Mar 2013 13:36:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI0Sz-0000cv-Pe for qemu-devel@nongnu.org; Tue, 19 Mar 2013 13:36:53 -0400 Message-ID: <5148A230.60908@redhat.com> Date: Tue, 19 Mar 2013 11:36:48 -0600 From: Eric Blake MIME-Version: 1.0 References: <1363362619-3190-1-git-send-email-pl@kamp.de> <1363362619-3190-8-git-send-email-pl@kamp.de> In-Reply-To: <1363362619-3190-8-git-send-email-pl@kamp.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2XUAHFCOQUAISEBEFVXCJ" Subject: Re: [Qemu-devel] [PATCHv2 7/9] migration: do not sent zero pages in bulk stage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2XUAHFCOQUAISEBEFVXCJ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/15/2013 09:50 AM, Peter Lieven wrote: > during bulk stage of ram migration if a page is a > zero page do not send it at all. > the memory at the destination reads as zero anyway. >=20 > even if there is an madvise with QEMU_MADV_DONTNEED > at the target upon receival of a zero page I have observed s/receival/receipt/ > that the target starts swapping if the memory is overcommitted. > it seems that the pages are dropped asynchronously. >=20 > Signed-off-by: Peter Lieven > --- > arch_init.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > +++ b/arch_init.c > @@ -432,9 +432,11 @@ static int ram_save_block(QEMUFile *f, bool last_s= tage) > bytes_sent =3D -1; > if (buffer_is_zero(p, TARGET_PAGE_SIZE)) { > acct_info.dup_pages++; > - bytes_sent =3D save_block_hdr(f, block, offset, cont, > - RAM_SAVE_FLAG_COMPRESS); > - qemu_put_byte(f, *p); > + if (!ram_bulk_stage) { > + bytes_sent =3D save_block_hdr(f, block, offset, co= nt, > + RAM_SAVE_FLAG_COMPRESS= ); > + qemu_put_byte(f, *p); Hmm, in patch 5/9, why not 'qemu_put_byte(f, 0)' instead of spending time dereferencing *p, since you already know the byte is 0? > + } > bytes_sent +=3D 1; Your accounting is now off. This increments bytes_sent even when nothing was sent in the bulk phase. When touching this line, consider using ++ instead of +=3D 1. > } else if (migrate_use_xbzrle()) { > current_addr =3D block->offset + offset; >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2XUAHFCOQUAISEBEFVXCJ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRSKIwAAoJEKeha0olJ0NqhqoIAJ1RJvVvQGB3IcMYieOS7hg7 A2W3ypul0LcypomFLfuf1xwx6HK1k1reba6oaHw/pLehe6LGJt/Md3hDrUrpieUU QZlNwyfwzNForLbJIIg6w4OHdPJ17G0ZTwy7ITgsRIuMYf0QVJmVUlFNeA1rFnU1 aZ7ZqJNDApR/P0lieMv1PRCoJJNkWOuNgiSCDXfEdtZF0xft/BwaYvmYjYT6VAkB xdLORRMyDI+HUmRQBkpJNkTOYeFYirnCdNMUlll8XhNef7HAhi79OtWdoOoFkTwT L62WIfFC0H0peOj3Nzu2ZbXCq9EE7180qGFhRNK8796zdGDniN5xU6sSgzOlqhY= =x99v -----END PGP SIGNATURE----- ------enig2XUAHFCOQUAISEBEFVXCJ--