From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juan Quintela Subject: Re: [PATCH RFC] migration: make sure to run iterate precopy during the bulk stage Date: Tue, 04 Sep 2018 11:12:18 +0200 Message-ID: <87va7lvd71.fsf@trasno.org> References: <5ab76c3e-9310-0e08-2f1b-4ff52bf229f8@gmail.com> Reply-To: quintela@redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: qemu-devel@nongnu.org, kvm , dgilbert@redhat.com To: Quan Xu Return-path: In-Reply-To: <5ab76c3e-9310-0e08-2f1b-4ff52bf229f8@gmail.com> (Quan Xu's message of "Wed, 29 Aug 2018 21:40:50 +0800") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel2=m.gmane.org@nongnu.org Sender: "Qemu-devel" List-Id: kvm.vger.kernel.org Quan Xu wrote: > From 8dbf7370e7ea1caab0b769d0d4dcdd072d14d421 Mon Sep 17 00:00:00 2001 > From: Quan Xu > Date: Wed, 29 Aug 2018 21:33:14 +0800 > Subject: [PATCH RFC] migration: make sure to run iterate precopy during t= he > =C2=A0bulk stage > > Since the bulk stage assumes in (migration_bitmap_find_dirty) that every > page is dirty, return a rough total ram as pending size to make sure that > migration thread continues to run iterate precopy during the bulk stage. > > Otherwise the downtime grows unpredictably, as migration thread needs to > send both the rest of pages and dirty pages during complete precopy. > > Signed-off-by: Quan Xu > --- > =C2=A0migration/ram.c | 3 ++- > =C2=A01 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/migration/ram.c b/migration/ram.c > index 79c8942..cfa304c 100644 > --- a/migration/ram.c > +++ b/migration/ram.c > @@ -3308,7 +3308,8 @@ static void ram_save_pending(QEMUFile *f, void > *opaque, uint64_t max_size, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* We can do postcopy, a= nd all the data is postcopiable */ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *res_compatible +=3D rem= aining_size; > =C2=A0=C2=A0=C2=A0=C2=A0 } else { > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *res_precopy_only +=3D remain= ing_size; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *res_precopy_only +=3D (rs->r= am_bulk_stage ? > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 ram_bytes_total() : remaining_size); > =C2=A0=C2=A0=C2=A0=C2=A0 } > =C2=A0} Hi I don't oppose the change. But what I don't understand is _why_ it is needed (or to say it otherwise, how it worked until now). I was wondering about the opposit direction, and just initialize the number of dirty pages at the beggining of the loop and then let decrease it for each processed page. I don't remember either how big was the speedud of not walking the bitmap on the 1st stage to start with. Later, Juan.