From patchwork Thu Jun 28 19:22:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 167945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4BFA4B7004 for ; Fri, 29 Jun 2012 05:23:21 +1000 (EST) Received: from localhost ([::1]:35093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkKJD-0000f3-0L for incoming@patchwork.ozlabs.org; Thu, 28 Jun 2012 15:23:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkKIR-0007gf-Rb for qemu-devel@nongnu.org; Thu, 28 Jun 2012 15:22:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SkKIQ-0002xS-1F for qemu-devel@nongnu.org; Thu, 28 Jun 2012 15:22:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkKIP-0002xA-On for qemu-devel@nongnu.org; Thu, 28 Jun 2012 15:22:29 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5SJMSsg022193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Jun 2012 15:22:28 -0400 Received: from trasno.mitica (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q5SJMB81000894; Thu, 28 Jun 2012 15:22:27 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 28 Jun 2012 21:22:09 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: owasserm@redhat.com Subject: [Qemu-devel] [PATCH 11/12] ram: iterate phase X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We only need to synchronize the bitmap when the number of dirty pages is low. Not every time that we call the function. Signed-off-by: Juan Quintela --- arch_init.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch_init.c b/arch_init.c index fe843a7..8299c15 100644 --- a/arch_init.c +++ b/arch_init.c @@ -348,8 +348,6 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) int i; uint64_t expected_time; - memory_global_sync_dirty_bitmap(get_system_memory()); - bytes_transferred_last = bytes_transferred; bwidth = qemu_get_clock_ns(rt_clock); @@ -397,7 +395,12 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) DPRINTF("ram_save_live: expected(%ld) <= max(%ld)?\n", expected_time, migrate_max_downtime()); - return expected_time <= migrate_max_downtime(); + if (expected_time <= migrate_max_downtime()) { + memory_global_sync_dirty_bitmap(get_system_memory()); + + return expected_time <= migrate_max_downtime(); + } + return 0; } static int ram_save_complete(QEMUFile *f, void *opaque)