|
|
1bdc94 |
From cb638b3d14fb19db26f6108a08f1a3b62a96b6c3 Mon Sep 17 00:00:00 2001
|
|
|
1bdc94 |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
1bdc94 |
Date: Fri, 22 Jun 2018 18:59:53 +0200
|
|
|
1bdc94 |
Subject: [PATCH 14/57] migration: move some code to ram_save_host_page
|
|
|
1bdc94 |
|
|
|
1bdc94 |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
1bdc94 |
Message-id: <20180622190005.21297-7-dgilbert@redhat.com>
|
|
|
1bdc94 |
Patchwork-id: 81007
|
|
|
1bdc94 |
O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH 06/18] migration: move some code to ram_save_host_page
|
|
|
1bdc94 |
Bugzilla: 1584139
|
|
|
1bdc94 |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
From: Xiao Guangrong <xiaoguangrong@tencent.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Move some code from ram_save_target_page() to ram_save_host_page()
|
|
|
1bdc94 |
to make it be more readable for latter patches that dramatically
|
|
|
1bdc94 |
clean ram_save_target_page() up
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Reviewed-by: Peter Xu <peterx@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
|
|
|
1bdc94 |
Message-Id: <20180330075128.26919-7-xiaoguangrong@tencent.com>
|
|
|
1bdc94 |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
1bdc94 |
(cherry picked from commit 1faa5665c0f1df2eff291454a3a85625a3bc93dd)
|
|
|
1bdc94 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
1bdc94 |
---
|
|
|
1bdc94 |
migration/ram.c | 43 +++++++++++++++++++------------------------
|
|
|
1bdc94 |
1 file changed, 19 insertions(+), 24 deletions(-)
|
|
|
1bdc94 |
|
|
|
1bdc94 |
diff --git a/migration/ram.c b/migration/ram.c
|
|
|
1bdc94 |
index 8dc98a5..106fcf1 100644
|
|
|
1bdc94 |
--- a/migration/ram.c
|
|
|
1bdc94 |
+++ b/migration/ram.c
|
|
|
1bdc94 |
@@ -1484,38 +1484,23 @@ err:
|
|
|
1bdc94 |
* Returns the number of pages written
|
|
|
1bdc94 |
*
|
|
|
1bdc94 |
* @rs: current RAM state
|
|
|
1bdc94 |
- * @ms: current migration state
|
|
|
1bdc94 |
* @pss: data about the page we want to send
|
|
|
1bdc94 |
* @last_stage: if we are at the completion stage
|
|
|
1bdc94 |
*/
|
|
|
1bdc94 |
static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss,
|
|
|
1bdc94 |
bool last_stage)
|
|
|
1bdc94 |
{
|
|
|
1bdc94 |
- int res = 0;
|
|
|
1bdc94 |
-
|
|
|
1bdc94 |
- /* Check the pages is dirty and if it is send it */
|
|
|
1bdc94 |
- if (migration_bitmap_clear_dirty(rs, pss->block, pss->page)) {
|
|
|
1bdc94 |
- /*
|
|
|
1bdc94 |
- * If xbzrle is on, stop using the data compression after first
|
|
|
1bdc94 |
- * round of migration even if compression is enabled. In theory,
|
|
|
1bdc94 |
- * xbzrle can do better than compression.
|
|
|
1bdc94 |
- */
|
|
|
1bdc94 |
- if (migrate_use_compression() &&
|
|
|
1bdc94 |
- (rs->ram_bulk_stage || !migrate_use_xbzrle())) {
|
|
|
1bdc94 |
- res = ram_save_compressed_page(rs, pss, last_stage);
|
|
|
1bdc94 |
- } else {
|
|
|
1bdc94 |
- res = ram_save_page(rs, pss, last_stage);
|
|
|
1bdc94 |
- }
|
|
|
1bdc94 |
-
|
|
|
1bdc94 |
- if (res < 0) {
|
|
|
1bdc94 |
- return res;
|
|
|
1bdc94 |
- }
|
|
|
1bdc94 |
- if (pss->block->unsentmap) {
|
|
|
1bdc94 |
- clear_bit(pss->page, pss->block->unsentmap);
|
|
|
1bdc94 |
- }
|
|
|
1bdc94 |
+ /*
|
|
|
1bdc94 |
+ * If xbzrle is on, stop using the data compression after first
|
|
|
1bdc94 |
+ * round of migration even if compression is enabled. In theory,
|
|
|
1bdc94 |
+ * xbzrle can do better than compression.
|
|
|
1bdc94 |
+ */
|
|
|
1bdc94 |
+ if (migrate_use_compression() &&
|
|
|
1bdc94 |
+ (rs->ram_bulk_stage || !migrate_use_xbzrle())) {
|
|
|
1bdc94 |
+ return ram_save_compressed_page(rs, pss, last_stage);
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
|
|
|
1bdc94 |
- return res;
|
|
|
1bdc94 |
+ return ram_save_page(rs, pss, last_stage);
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
|
|
|
1bdc94 |
/**
|
|
|
1bdc94 |
@@ -1544,12 +1529,22 @@ static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss,
|
|
|
1bdc94 |
qemu_ram_pagesize(pss->block) >> TARGET_PAGE_BITS;
|
|
|
1bdc94 |
|
|
|
1bdc94 |
do {
|
|
|
1bdc94 |
+ /* Check the pages is dirty and if it is send it */
|
|
|
1bdc94 |
+ if (!migration_bitmap_clear_dirty(rs, pss->block, pss->page)) {
|
|
|
1bdc94 |
+ pss->page++;
|
|
|
1bdc94 |
+ continue;
|
|
|
1bdc94 |
+ }
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
tmppages = ram_save_target_page(rs, pss, last_stage);
|
|
|
1bdc94 |
if (tmppages < 0) {
|
|
|
1bdc94 |
return tmppages;
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
|
|
|
1bdc94 |
pages += tmppages;
|
|
|
1bdc94 |
+ if (pss->block->unsentmap) {
|
|
|
1bdc94 |
+ clear_bit(pss->page, pss->block->unsentmap);
|
|
|
1bdc94 |
+ }
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
pss->page++;
|
|
|
1bdc94 |
} while ((pss->page & (pagesize_bits - 1)) &&
|
|
|
1bdc94 |
offset_in_ramblock(pss->block, pss->page << TARGET_PAGE_BITS));
|
|
|
1bdc94 |
--
|
|
|
1bdc94 |
1.8.3.1
|
|
|
1bdc94 |
|