yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-migration-remove-ram_save_compressed_page.patch

ae23c9
From e3c0812c4d61c956ac5b0641826c4e4fbda55954 Mon Sep 17 00:00:00 2001
ae23c9
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
ae23c9
Date: Wed, 1 Aug 2018 13:55:14 +0100
ae23c9
Subject: [PATCH 10/21] migration: remove ram_save_compressed_page()
ae23c9
ae23c9
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
ae23c9
Message-id: <20180801135522.11658-11-dgilbert@redhat.com>
ae23c9
Patchwork-id: 81578
ae23c9
O-Subject: [qemu-kvm RHEL8/virt212 PATCH 10/18] migration: remove ram_save_compressed_page()
ae23c9
Bugzilla: 1594384
ae23c9
RH-Acked-by: Peter Xu <peterx@redhat.com>
ae23c9
RH-Acked-by: John Snow <jsnow@redhat.com>
ae23c9
RH-Acked-by: Juan Quintela <quintela@redhat.com>
ae23c9
ae23c9
From: Xiao Guangrong <xiaoguangrong@tencent.com>
ae23c9
ae23c9
Now, we can reuse the path in ram_save_page() to post the page out
ae23c9
as normal, then the only thing remained in ram_save_compressed_page()
ae23c9
is compression that we can move it out to the caller
ae23c9
ae23c9
Reviewed-by: Peter Xu <peterx@redhat.com>
ae23c9
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ae23c9
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
ae23c9
Message-Id: <20180330075128.26919-11-xiaoguangrong@tencent.com>
ae23c9
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ae23c9
(cherry picked from commit da3f56cb2e767016d3f204837a77caf35b463f90)
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 migration/ram.c | 45 ++++++++-------------------------------------
ae23c9
 1 file changed, 8 insertions(+), 37 deletions(-)
ae23c9
ae23c9
diff --git a/migration/ram.c b/migration/ram.c
ae23c9
index 908879f..466609f 100644
ae23c9
--- a/migration/ram.c
ae23c9
+++ b/migration/ram.c
ae23c9
@@ -1186,41 +1186,6 @@ static int compress_page_with_multi_thread(RAMState *rs, RAMBlock *block,
ae23c9
 }
ae23c9
 
ae23c9
 /**
ae23c9
- * ram_save_compressed_page: compress the given page and send it to the stream
ae23c9
- *
ae23c9
- * Returns the number of pages written.
ae23c9
- *
ae23c9
- * @rs: current RAM state
ae23c9
- * @block: block that contains the page we want to send
ae23c9
- * @offset: offset inside the block for the page
ae23c9
- * @last_stage: if we are at the completion stage
ae23c9
- */
ae23c9
-static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
ae23c9
-                                    bool last_stage)
ae23c9
-{
ae23c9
-    int pages = -1;
ae23c9
-    uint8_t *p;
ae23c9
-    RAMBlock *block = pss->block;
ae23c9
-    ram_addr_t offset = pss->page << TARGET_PAGE_BITS;
ae23c9
-
ae23c9
-    p = block->host + offset;
ae23c9
-
ae23c9
-    if (block != rs->last_sent_block) {
ae23c9
-        /*
ae23c9
-         * Make sure the first page is sent out before other pages.
ae23c9
-         *
ae23c9
-         * we post it as normal page as compression will take much
ae23c9
-         * CPU resource.
ae23c9
-         */
ae23c9
-        pages = save_normal_page(rs, block, offset, p, true);
ae23c9
-    } else {
ae23c9
-        pages = compress_page_with_multi_thread(rs, block, offset);
ae23c9
-    }
ae23c9
-
ae23c9
-    return pages;
ae23c9
-}
ae23c9
-
ae23c9
-/**
ae23c9
  * find_dirty_block: find the next dirty page and update any state
ae23c9
  * associated with the search process.
ae23c9
  *
ae23c9
@@ -1519,8 +1484,14 @@ static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss,
ae23c9
         return res;
ae23c9
     }
ae23c9
 
ae23c9
-    if (save_page_use_compression(rs)) {
ae23c9
-        return ram_save_compressed_page(rs, pss, last_stage);
ae23c9
+    /*
ae23c9
+     * Make sure the first page is sent out before other pages.
ae23c9
+     *
ae23c9
+     * we post it as normal page as compression will take much
ae23c9
+     * CPU resource.
ae23c9
+     */
ae23c9
+    if (block == rs->last_sent_block && save_page_use_compression(rs)) {
ae23c9
+        res = compress_page_with_multi_thread(rs, block, offset);
ae23c9
     }
ae23c9
 
ae23c9
     return ram_save_page(rs, pss, last_stage);
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9