From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coUU5-0007nK-5q for qemu-devel@nongnu.org; Thu, 16 Mar 2017 08:26:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coUU1-0006Cq-7q for qemu-devel@nongnu.org; Thu, 16 Mar 2017 08:26:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38634) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1coUU1-0006CP-1i for qemu-devel@nongnu.org; Thu, 16 Mar 2017 08:26:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1B2327E9E6 for ; Thu, 16 Mar 2017 12:26:21 +0000 (UTC) Date: Thu, 16 Mar 2017 12:26:16 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20170316122616.GH2567@work-vm> References: <20170315135021.6978-1-quintela@redhat.com> <20170315135021.6978-9-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170315135021.6978-9-quintela@redhat.com> Subject: Re: [Qemu-devel] [PATCH 08/31] ram: Move iterations_prev into RAMState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org * Juan Quintela (quintela@redhat.com) wrote: > Signed-off-by: Juan Quintela > --- > migration/ram.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/migration/ram.c b/migration/ram.c > index ae077c5..6cdad06 100644 > --- a/migration/ram.c > +++ b/migration/ram.c > @@ -157,6 +157,8 @@ struct RAMState { > int64_t num_dirty_pages_period; > /* xbzrle misses since the beggining of the period */ > uint64_t xbzrle_cache_miss_prev; > + /* number of iterations at the beggining of period */ ^ ^ One extra g, one missing n Other than that, Reviewed-by: Dr. David Alan Gilbert > + uint64_t iterations_prev; > }; > typedef struct RAMState RAMState; > > @@ -602,16 +604,13 @@ static void migration_bitmap_sync_range(ram_addr_t start, ram_addr_t length) > cpu_physical_memory_sync_dirty_bitmap(bitmap, start, length); > } > > -/* Fix me: there are too many global variables used in migration process. */ > -static uint64_t iterations_prev; > - > static void migration_bitmap_sync_init(RAMState *rs) > { > rs->start_time = 0; > rs->bytes_xfer_prev = 0; > rs->num_dirty_pages_period = 0; > rs->xbzrle_cache_miss_prev = 0; > - iterations_prev = 0; > + rs->iterations_prev = 0; > } > > /* Returns a summary bitmap of the page sizes of all RAMBlocks; > @@ -687,13 +686,13 @@ static void migration_bitmap_sync(RAMState *rs) > } > > if (migrate_use_xbzrle()) { > - if (iterations_prev != acct_info.iterations) { > + if (rs->iterations_prev != acct_info.iterations) { > acct_info.xbzrle_cache_miss_rate = > (double)(acct_info.xbzrle_cache_miss - > rs->xbzrle_cache_miss_prev) / > - (acct_info.iterations - iterations_prev); > + (acct_info.iterations - rs->iterations_prev); > } > - iterations_prev = acct_info.iterations; > + rs->iterations_prev = acct_info.iterations; > rs->xbzrle_cache_miss_prev = acct_info.xbzrle_cache_miss; > } > s->dirty_pages_rate = rs->num_dirty_pages_period * 1000 > -- > 2.9.3 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK