[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/12] migration: do not flush_compressed_data at the
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 05/12] migration: do not flush_compressed_data at the end of iteration |
Date: |
Thu, 13 Sep 2018 14:53:36 +0200 |
From: Xiao Guangrong <address@hidden>
flush_compressed_data() needs to wait all compression threads to
finish their work, after that all threads are free until the
migration feeds new request to them, reducing its call can improve
the throughput and use CPU resource more effectively
We do not need to flush all threads at the end of iteration, the
data can be kept locally until the memory block is changed or
memory migration starts over in that case we will meet a dirtied
page which may still exists in compression threads's ring
Signed-off-by: Xiao Guangrong <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
migration/ram.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 2add09174d..e152831254 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1996,17 +1996,22 @@ static bool find_dirty_block(RAMState *rs,
PageSearchStatus *pss, bool *again)
pss->page = 0;
pss->block = QLIST_NEXT_RCU(pss->block, next);
if (!pss->block) {
+ /*
+ * If memory migration starts over, we will meet a dirtied page
+ * which may still exists in compression threads's ring, so we
+ * should flush the compressed data to make sure the new page
+ * is not overwritten by the old one in the destination.
+ *
+ * Also If xbzrle is on, stop using the data compression at this
+ * point. In theory, xbzrle can do better than compression.
+ */
+ flush_compressed_data(rs);
+
/* Hit the end of the list */
pss->block = QLIST_FIRST_RCU(&ram_list.blocks);
/* Flag that we've looped */
pss->complete_round = true;
rs->ram_bulk_stage = false;
- if (migrate_use_xbzrle()) {
- /* If xbzrle is on, stop using the data compression at this
- * point. In theory, xbzrle can do better than compression.
- */
- flush_compressed_data(rs);
- }
}
/* Didn't find anything this time, but try again on the new block */
*again = true;
@@ -3219,7 +3224,6 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
}
i++;
}
- flush_compressed_data(rs);
rcu_read_unlock();
/*
--
2.17.1
- [Qemu-devel] [PULL 00/12] Migration queue, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 02/12] migration: fix calculating xbzrle_counters.cache_miss_rate, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 01/12] migration/rdma: Fix uninitialised rdma_return_path, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 03/12] migration: handle the error condition properly, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 07/12] migration: use save_page_use_compression in flush_compressed_data, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 04/12] Add a hint message to loadvm and exits on failure, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 06/12] migration: show the statistics of compression, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 05/12] migration: do not flush_compressed_data at the end of iteration,
Juan Quintela <=
- [Qemu-devel] [PULL 08/12] tests/migration: Convert x86 boot block compilation script into Makefile, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 10/12] tests/migration: Add migration-test header file, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 09/12] tests/migration: Support cross compilation in generating boot header file, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 11/12] tests: Add migration test for aarch64, Juan Quintela, 2018/09/13
- [Qemu-devel] [PULL 12/12] tests/migration: Enable the migration test on s390x, too, Juan Quintela, 2018/09/13
- Re: [Qemu-devel] [PULL 00/12] Migration queue, Peter Maydell, 2018/09/25