qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [v3 09/13] migration: Make compression co-work with xbzrle


From: Liang Li
Subject: [Qemu-devel] [v3 09/13] migration: Make compression co-work with xbzrle
Date: Fri, 12 Dec 2014 09:29:02 +0800

Now, multiple thread compression can co-work with xbzrle. when
xbzrle is on, multiple thread compression will only work at the
first round of ram data sync.

Signed-off-by: Liang Li <address@hidden>
Signed-off-by: Yang Zhang <address@hidden>
---
 arch_init.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 4109ad7..14bc486 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -905,8 +905,11 @@ static int ram_save_compressed_page(QEMUFile *f, RAMBlock* 
block,
      * block, and all the pages in last block should have been sent
      * out, keeping this order is important.
      */
-    if (block != last_sent_block) {
-        flush_compressed_data(f);
+    if ((!ram_bulk_stage && migrate_use_xbzrle()) ||
+                block != last_sent_block) {
+        if (block != last_sent_block) {
+            flush_compressed_data(f);
+        }
         bytes_sent = save_zero_and_xbzrle_page(f, block, offset,
                 last_stage, NULL);
         if (bytes_sent == -1) {
@@ -961,6 +964,12 @@ static int ram_find_and_save_block(QEMUFile *f, bool 
last_stage)
                 block = QTAILQ_FIRST(&ram_list.blocks);
                 complete_round = true;
                 ram_bulk_stage = false;
+                if (migrate_use_xbzrle()) {
+                    /* if xbzrle is on, we terminate the compression thread
+                     * at this point, there is no benefit from muti-thead */
+                    flush_compressed_data(f);
+                    terminate_compression_threads();
+                }
             }
         } else {
             if (migrate_use_compression()) {
-- 
1.8.3.1




reply via email to

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