From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLkJN-0004Uq-72 for qemu-devel@nongnu.org; Wed, 11 Feb 2015 22:19:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLkJF-0005s1-NY for qemu-devel@nongnu.org; Wed, 11 Feb 2015 22:19:29 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:44852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLkJF-0005rd-2t for qemu-devel@nongnu.org; Wed, 11 Feb 2015 22:19:21 -0500 From: zhanghailiang Date: Thu, 12 Feb 2015 11:17:10 +0800 Message-ID: <1423711034-5340-24-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1423711034-5340-1-git-send-email-zhang.zhanghailiang@huawei.com> References: <1423711034-5340-1-git-send-email-zhang.zhanghailiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH RFC v3 23/27] COLO: Improve checkpoint efficiency by do additional periodic checkpoint List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: zhanghailiang , yunhong.jiang@intel.com, eddie.dong@intel.com, dgilbert@redhat.com, peter.huangpeng@huawei.com, stefanha@redhat.com, pbonzini@redhat.com, Yang Hongyang Besides normal checkpoint which according to the result of net packets comparing, We do additional checkpoint periodically, it will reduce the number of dirty pages when do one checkpoint, if we don't do checkpoint for a long time (This is a special case when the net packets is always consistent). Signed-off-by: zhanghailiang Signed-off-by: Yang Hongyang --- migration/colo.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 3e13611..579aabf 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -10,6 +10,7 @@ * later. See the COPYING file in the top-level directory. */ +#include "qemu/timer.h" #include "sysemu/sysemu.h" #include "migration/migration-colo.h" #include "qemu/error-report.h" @@ -290,6 +291,8 @@ out: static void *colo_thread(void *opaque) { MigrationState *s = opaque; + int64_t start_time = qemu_clock_get_ms(QEMU_CLOCK_HOST); + int64_t current_time; QEMUFile *colo_control = NULL; int ret; @@ -338,8 +341,14 @@ static void *colo_thread(void *opaque) * No checkpoint is needed, wait for 1ms and then * check if we need checkpoint again */ - usleep(1000); - continue; + current_time = qemu_clock_get_ms(QEMU_CLOCK_HOST); + if (current_time - start_time < CHKPOINT_TIMER) { + if (failover_request_is_set()) { + goto out; + } + usleep(1000); + continue; + } } else { DPRINTF("Net packets is not consistent!!!\n"); } @@ -348,6 +357,8 @@ static void *colo_thread(void *opaque) if (do_colo_transaction(s, colo_control)) { goto out; } + + start_time = qemu_clock_get_ms(QEMU_CLOCK_HOST); } out: -- 1.7.12.4