Received: from eggs.gnu.org ([2001:4830:134:3::10]:60593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agu2M-00080t-K2 for qemu-devel@nongnu.org; Fri, 18 Mar 2016 09:01:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agu2J-0007v7-8l for qemu-devel@nongnu.org; Fri, 18 Mar 2016 09:01:54 -0400 Received: from mail-am1on0131.outbound.protection.outlook.com ([157.56.112.131]:32124 helo=emea01-am1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agu2I-0007us-DY for qemu-devel@nongnu.org; Fri, 18 Mar 2016 09:01:51 -0400 Date: Fri, 18 Mar 2016 14:27:54 +0300 From: Roman Kagan Message-ID: <20160318112746.GA7333@rkaganb.sw.ru> References: <1457082167-12254-1-git-send-email-jitendra.kolhe@hpe.com> <20160310094912.GC9715@rkaganb.sw.ru> <56E25EBF.6050109@hpe.com> <56E29BD9.8010306@hpe.com> <56E2D88D.2060702@hpe.com> <56E80C2D.9020304@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <56E80C2D.9020304@hpe.com> Subject: Re: [Qemu-devel] [PATCH v1] migration: skip sending ram pages released by virtio-balloon driver. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jitendra Kolhe Cc: "simhan@hpe.com" , "mohan_parthasarathy@hpe.com" , "Li, Liang Z" , "qemu-devel@nongnu.org" , "dgilbert@redhat.com" [ Sorry I've lost this thread with email setup changes on my side; catching up ] On Tue, Mar 15, 2016 at 06:50:45PM +0530, Jitendra Kolhe wrote: > On 3/11/2016 8:09 PM, Jitendra Kolhe wrote: > > Here is what > >I tried, let=E2=80=99s say we have 3 versions of qemu (below timings are= for > >16GB idle guest with 12GB ballooned out) > > > >v1. Unmodified qemu =E2=80=93 absolutely not code change =E2=80=93 Total= Migration time > >=3D ~7600ms (I rounded this one to ~8000ms) > >v2. Modified qemu 1 =E2=80=93 with proposed patch set (which skips both = zero > >pages scan and migrating control information for ballooned out pages) - > >Total Migration time =3D ~5700ms > >v3. Modified qemu 2 =E2=80=93 only with changes to save_zero_page() as d= iscussed > >in previous mail (and of course using proposed patch set only to > >maintain bitmap for ballooned out pages) =E2=80=93 Total migration time = is > >irrelevant in this case. > >Total Zero page scan time =3D ~1789ms > >Total (save_page_header + qemu_put_byte(f, 0)) =3D ~556ms. > >Everything seems to add up here (may not be exact) =E2=80=93 5700+1789+5= 59 =3D > >~8000ms > > > >I see 2 factors that we have not considered in this add up a. overhead > >for migrating balloon bitmap to target and b. as you mentioned below > >overhead of qemu_clock_get_ns(). >=20 > Missed one more factor of testing each page against balloon bitmap during > migration, which is consuming around ~320ms for same configuration. If we > remove this overhead which is introduced by proposed patch set from above > calculation we almost get total migration time for unmodified qemu > (5700-320+1789+559=3D~7700ms) I'm a bit lost in the numbers you quote, so let me try with back-of-the-envelope calculation. First off, the way you identify pages that don't need to be sent is basically orthogonal to how you optimize the protocol to send them. So teaching is_zero_range() to consult unmapped or ballooned out page map looks like a low-hanging fruit that may benefit the migration time by avoiding scanning the memory, without protocol changes. [And vice versa, if sending the zero pages bitmap brought so big benefit it would make sense to apply it to pages found by scanning, too]. Now regarding the protocol: - as a first approximation, let's speak in terms of transferred data size - consider a VM using 1/10 of its memory (I think this can be considered an extreme of over-provisioning) - a whiteout is 3 decimal orders smaller than a page, so with zero pages replaced by whiteouts (current protocol) the overall transferred data size for zero pages is on the order of a percent of the total transferred data size - zero page bitmap would reduce that further by a couple of orders So, if this calculation is not totally off, extending the protocol to use zero page bitmaps is unlikely to give an improvement at more than a percent level. I'm not sure it pays off the extra code paths and incompatible protocol changes... Roman.