[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 40/65] ram: Remove compression_switch and inline its
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 40/65] ram: Remove compression_switch and inline its logic |
Date: |
Fri, 21 Apr 2017 13:56:21 +0200 |
We can calculate its value, so we don't create a variable for it.
Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
--
After Peter and Dave review, I dropped the variable and just inlined
the condition.
Fix typo
---
migration/ram.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 14d54fd..fa5a290 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -336,7 +336,6 @@ static QemuCond comp_done_cond;
/* The empty QEMUFileOps will be used by file in CompressParam */
static const QEMUFileOps empty_ops = { };
-static bool compression_switch;
static DecompressParam *decomp_param;
static QemuThread *decompress_threads;
static QemuMutex decomp_done_lock;
@@ -420,7 +419,6 @@ void migrate_compress_threads_create(void)
if (!migrate_use_compression()) {
return;
}
- compression_switch = true;
thread_count = migrate_compress_threads();
compress_threads = g_new0(QemuThread, thread_count);
comp_param = g_new0(CompressParam, thread_count);
@@ -1092,7 +1090,6 @@ static bool find_dirty_block(RAMState *rs,
PageSearchStatus *pss,
* point. In theory, xbzrle can do better than compression.
*/
flush_compressed_data(rs);
- compression_switch = false;
}
}
/* Didn't find anything this time, but try again on the new block */
@@ -1326,7 +1323,14 @@ static int ram_save_target_page(RAMState *rs,
MigrationState *ms,
/* Check the pages is dirty and if it is send it */
if (migration_bitmap_clear_dirty(rs, dirty_ram_abs)) {
unsigned long *unsentmap;
- if (compression_switch && migrate_use_compression()) {
+ /*
+ * If xbzrle is on, stop using the data compression after first
+ * round of migration even if compression is enabled. In theory,
+ * xbzrle can do better than compression.
+ */
+
+ if (migrate_use_compression()
+ && (rs->ram_bulk_stage || !migrate_use_xbzrle())) {
res = ram_save_compressed_page(rs, ms, pss, last_stage);
} else {
res = ram_save_page(rs, ms, pss, last_stage);
--
2.9.3
- [Qemu-devel] [PULL 31/65] ram: Remove ram_save_remaining, (continued)
- [Qemu-devel] [PULL 31/65] ram: Remove ram_save_remaining, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 30/65] ram: Use the RAMState bytes_transferred parameter, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 32/65] ram: Move last_req_rb to RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 33/65] ram: Move src_page_req* to RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 34/65] ram: Create ram_dirty_sync_count(), Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 35/65] ram: Remove dirty_bytes_rate, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 36/65] ram: Move dirty_pages_rate to RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 37/65] ram: Move postcopy_requests into RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 38/65] ram: Add QEMUFile to RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 39/65] ram: Move QEMUFile into RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 40/65] ram: Remove compression_switch and inline its logic,
Juan Quintela <=
- [Qemu-devel] [PULL 41/65] migration: Remove MigrationState from migration_in_postcopy, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 42/65] ram: We don't need MigrationState parameter anymore, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 43/65] ram: Rename qemu_target_page_bits() to qemu_target_page_size(), Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 44/65] ram: Add page-size to output in 'info migrate', Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 45/65] ram: Pass RAMBlock to bitmap_sync, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 46/65] ram: ram_discard_range() don't use the mis parameter, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 47/65] ram: reorganize last_sent_block, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 48/65] ram: Use page number instead of an address for the bitmap operations, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 49/65] ram: Remember last_page instead of last_offset, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 50/65] ram: Change offset field in PageSearchStatus to page, Juan Quintela, 2017/04/21