qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH RFC v3 23/27] COLO: Improve checkpoint efficiency by


From: zhanghailiang
Subject: [Qemu-devel] [PATCH RFC v3 23/27] COLO: Improve checkpoint efficiency by do additional periodic checkpoint
Date: Thu, 12 Feb 2015 11:17:10 +0800

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 <address@hidden>
Signed-off-by: Yang Hongyang <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]