|
|
357786 |
From 991ad76f13534cd2f22b30ba8b556f284f28c5c6 Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
357786 |
Date: Fri, 22 Jun 2018 18:59:48 +0200
|
|
|
357786 |
Subject: [PATCH 09/57] migration: stop compressing page in migration thread
|
|
|
357786 |
|
|
|
357786 |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
357786 |
Message-id: <20180622190005.21297-2-dgilbert@redhat.com>
|
|
|
357786 |
Patchwork-id: 81005
|
|
|
357786 |
O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH 01/18] migration: stop compressing page in migration thread
|
|
|
357786 |
Bugzilla: 1584139
|
|
|
357786 |
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
|
|
357786 |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
357786 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
From: Xiao Guangrong <xiaoguangrong@tencent.com>
|
|
|
357786 |
|
|
|
357786 |
As compression is a heavy work, do not do it in migration thread,
|
|
|
357786 |
instead, we post it out as a normal page
|
|
|
357786 |
|
|
|
357786 |
Reviewed-by: Wei Wang <wei.w.wang@intel.com>
|
|
|
357786 |
Reviewed-by: Peter Xu <peterx@redhat.com>
|
|
|
357786 |
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
357786 |
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
|
|
|
357786 |
Message-Id: <20180330075128.26919-2-xiaoguangrong@tencent.com>
|
|
|
357786 |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
357786 |
(cherry picked from commit 263a289ae61c8344a417a95b0142650fdff3af56)
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
migration/ram.c | 32 ++++++++++++++++----------------
|
|
|
357786 |
1 file changed, 16 insertions(+), 16 deletions(-)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/migration/ram.c b/migration/ram.c
|
|
|
357786 |
index 00c06b5..f27038a 100644
|
|
|
357786 |
--- a/migration/ram.c
|
|
|
357786 |
+++ b/migration/ram.c
|
|
|
357786 |
@@ -1138,7 +1138,7 @@ static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
|
|
|
357786 |
int pages = -1;
|
|
|
357786 |
uint64_t bytes_xmit = 0;
|
|
|
357786 |
uint8_t *p;
|
|
|
357786 |
- int ret, blen;
|
|
|
357786 |
+ int ret;
|
|
|
357786 |
RAMBlock *block = pss->block;
|
|
|
357786 |
ram_addr_t offset = pss->page << TARGET_PAGE_BITS;
|
|
|
357786 |
|
|
|
357786 |
@@ -1168,23 +1168,23 @@ static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
|
|
|
357786 |
if (block != rs->last_sent_block) {
|
|
|
357786 |
flush_compressed_data(rs);
|
|
|
357786 |
pages = save_zero_page(rs, block, offset);
|
|
|
357786 |
- if (pages == -1) {
|
|
|
357786 |
- /* Make sure the first page is sent out before other pages */
|
|
|
357786 |
- bytes_xmit = save_page_header(rs, rs->f, block, offset |
|
|
|
357786 |
- RAM_SAVE_FLAG_COMPRESS_PAGE);
|
|
|
357786 |
- blen = qemu_put_compression_data(rs->f, p, TARGET_PAGE_SIZE,
|
|
|
357786 |
- migrate_compress_level());
|
|
|
357786 |
- if (blen > 0) {
|
|
|
357786 |
- ram_counters.transferred += bytes_xmit + blen;
|
|
|
357786 |
- ram_counters.normal++;
|
|
|
357786 |
- pages = 1;
|
|
|
357786 |
- } else {
|
|
|
357786 |
- qemu_file_set_error(rs->f, blen);
|
|
|
357786 |
- error_report("compressed data failed!");
|
|
|
357786 |
- }
|
|
|
357786 |
- }
|
|
|
357786 |
if (pages > 0) {
|
|
|
357786 |
ram_release_pages(block->idstr, offset, pages);
|
|
|
357786 |
+ } else {
|
|
|
357786 |
+ /*
|
|
|
357786 |
+ * Make sure the first page is sent out before other pages.
|
|
|
357786 |
+ *
|
|
|
357786 |
+ * we post it as normal page as compression will take much
|
|
|
357786 |
+ * CPU resource.
|
|
|
357786 |
+ */
|
|
|
357786 |
+ ram_counters.transferred += save_page_header(rs, rs->f, block,
|
|
|
357786 |
+ offset | RAM_SAVE_FLAG_PAGE);
|
|
|
357786 |
+ qemu_put_buffer_async(rs->f, p, TARGET_PAGE_SIZE,
|
|
|
357786 |
+ migrate_release_ram() &
|
|
|
357786 |
+ migration_in_postcopy());
|
|
|
357786 |
+ ram_counters.transferred += TARGET_PAGE_SIZE;
|
|
|
357786 |
+ ram_counters.normal++;
|
|
|
357786 |
+ pages = 1;
|
|
|
357786 |
}
|
|
|
357786 |
} else {
|
|
|
357786 |
pages = save_zero_page(rs, block, offset);
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|