From patchwork Fri Jul 13 07:23:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 170829 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 F37282C0355 for ; Fri, 13 Jul 2012 18:51:45 +1000 (EST) Received: from localhost ([::1]:54862 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpaFF-0001JV-RA for incoming@patchwork.ozlabs.org; Fri, 13 Jul 2012 03:24:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpaEP-0007oa-7I for qemu-devel@nongnu.org; Fri, 13 Jul 2012 03:24:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpaEJ-0004PD-A7 for qemu-devel@nongnu.org; Fri, 13 Jul 2012 03:24:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpaEJ-0004P6-2K for qemu-devel@nongnu.org; Fri, 13 Jul 2012 03:23:59 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6D7NwZD019196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 13 Jul 2012 03:23:58 -0400 Received: from trasno.mitica (ovpn-116-28.ams2.redhat.com [10.36.116.28]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q6D7NjR0014276; Fri, 13 Jul 2012 03:23:57 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 13 Jul 2012 09:23:32 +0200 Message-Id: <1342164224-32709-11-git-send-email-quintela@redhat.com> In-Reply-To: <1342164224-32709-1-git-send-email-quintela@redhat.com> References: <1342164224-32709-1-git-send-email-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 10/22] ram: save_live_complete() only do one loop 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 were doing the same loop that stage2, and a new one for stage3. We only need the one for stage3. Signed-off-by: Juan Quintela --- arch_init.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/arch_init.c b/arch_init.c index 2a6fc77..3c38a52 100644 --- a/arch_init.c +++ b/arch_init.c @@ -403,42 +403,10 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) static int ram_save_complete(QEMUFile *f, void *opaque) { - double bwidth = 0; - int ret; - int i; int bytes_sent; memory_global_sync_dirty_bitmap(get_system_memory()); - bwidth = qemu_get_clock_ns(rt_clock); - - i = 0; - while ((ret = qemu_file_rate_limit(f)) == 0) { - bytes_sent = ram_save_block(f); - bytes_transferred += bytes_sent; - if (bytes_sent == 0) { /* no more blocks */ - break; - } - /* we want to check in the 1st loop, just in case it was the 1st time - and we had to sync the dirty bitmap. - qemu_get_clock_ns() is a bit expensive, so we only check each some - iterations - */ - if ((i & 63) == 0) { - uint64_t t1 = (qemu_get_clock_ns(rt_clock) - bwidth) / 1000000; - if (t1 > MAX_WAIT) { - DPRINTF("big wait: " PRIu64 " milliseconds, %d iterations\n", - t1, i); - break; - } - } - i++; - } - - if (ret < 0) { - return ret; - } - /* try transferring iterative blocks of memory */ /* flush all remaining blocks regardless of rate limiting */