diff mbox

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

Message ID 1418347746-15829-10-git-send-email-liang.z.li@intel.com
State New
Headers show

Commit Message

Li, Liang Z Dec. 12, 2014, 1:29 a.m. UTC
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 <liang.z.li@intel.com>
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
---
 arch_init.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Dr. David Alan Gilbert Jan. 23, 2015, 1:40 p.m. UTC | #1
* Liang Li (liang.z.li@intel.com) wrote:
> 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 <liang.z.li@intel.com>
> Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
> ---
>  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 */

Typo: 'muti-thead' -> 'multi-thread'

Dave

> +                    flush_compressed_data(f);
> +                    terminate_compression_threads();
> +                }
>              }
>          } else {
>              if (migrate_use_compression()) {
> -- 
> 1.8.3.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox

Patch

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()) {