diff options
Diffstat (limited to 'migration/ram.c')
-rw-r--r-- | migration/ram.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/migration/ram.c b/migration/ram.c index 0e68099bf9..71320ed27a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -458,25 +458,18 @@ uint64_t ram_bytes_remaining(void) 0; } -/* - * NOTE: not all stats in ram_counters are used in reality. See comments - * for struct MigrationAtomicStats. The ultimate result of ram migration - * counters will be a merged version with both ram_counters and the atomic - * fields in ram_atomic_counters. - */ -MigrationStats ram_counters; -MigrationAtomicStats ram_atomic_counters; +RAMStats ram_counters; void ram_transferred_add(uint64_t bytes) { if (runstate_is_running()) { ram_counters.precopy_bytes += bytes; } else if (migration_in_postcopy()) { - stat64_add(&ram_atomic_counters.postcopy_bytes, bytes); + stat64_add(&ram_counters.postcopy_bytes, bytes); } else { ram_counters.downtime_bytes += bytes; } - stat64_add(&ram_atomic_counters.transferred, bytes); + stat64_add(&ram_counters.transferred, bytes); } void dirty_sync_missed_zero_copy(void) @@ -756,7 +749,7 @@ void mig_throttle_counter_reset(void) rs->time_last_bitmap_sync = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); rs->num_dirty_pages_period = 0; - rs->bytes_xfer_prev = stat64_get(&ram_atomic_counters.transferred); + rs->bytes_xfer_prev = stat64_get(&ram_counters.transferred); } /** @@ -1130,8 +1123,8 @@ uint64_t ram_pagesize_summary(void) uint64_t ram_get_total_transferred_pages(void) { - return stat64_get(&ram_atomic_counters.normal) + - stat64_get(&ram_atomic_counters.duplicate) + + return stat64_get(&ram_counters.normal) + + stat64_get(&ram_counters.duplicate) + compression_counters.pages + xbzrle_counters.pages; } @@ -1192,7 +1185,7 @@ static void migration_trigger_throttle(RAMState *rs) MigrationState *s = migrate_get_current(); uint64_t threshold = s->parameters.throttle_trigger_threshold; uint64_t bytes_xfer_period = - stat64_get(&ram_atomic_counters.transferred) - rs->bytes_xfer_prev; + stat64_get(&ram_counters.transferred) - rs->bytes_xfer_prev; uint64_t bytes_dirty_period = rs->num_dirty_pages_period * TARGET_PAGE_SIZE; uint64_t bytes_dirty_threshold = bytes_xfer_period * threshold / 100; @@ -1255,7 +1248,7 @@ static void migration_bitmap_sync(RAMState *rs) /* reset period counters */ rs->time_last_bitmap_sync = end_time; rs->num_dirty_pages_period = 0; - rs->bytes_xfer_prev = stat64_get(&ram_atomic_counters.transferred); + rs->bytes_xfer_prev = stat64_get(&ram_counters.transferred); } if (migrate_use_events()) { qapi_event_send_migration_pass(ram_counters.dirty_sync_count); @@ -1331,7 +1324,7 @@ static int save_zero_page(PageSearchStatus *pss, QEMUFile *f, RAMBlock *block, int len = save_zero_page_to_file(pss, f, block, offset); if (len) { - stat64_add(&ram_atomic_counters.duplicate, 1); + stat64_add(&ram_counters.duplicate, 1); ram_transferred_add(len); return 1; } @@ -1368,9 +1361,9 @@ static bool control_save_page(PageSearchStatus *pss, RAMBlock *block, } if (bytes_xmit > 0) { - stat64_add(&ram_atomic_counters.normal, 1); + stat64_add(&ram_counters.normal, 1); } else if (bytes_xmit == 0) { - stat64_add(&ram_atomic_counters.duplicate, 1); + stat64_add(&ram_counters.duplicate, 1); } return true; @@ -1402,7 +1395,7 @@ static int save_normal_page(PageSearchStatus *pss, RAMBlock *block, qemu_put_buffer(file, buf, TARGET_PAGE_SIZE); } ram_transferred_add(TARGET_PAGE_SIZE); - stat64_add(&ram_atomic_counters.normal, 1); + stat64_add(&ram_counters.normal, 1); return 1; } @@ -1458,7 +1451,7 @@ static int ram_save_multifd_page(QEMUFile *file, RAMBlock *block, if (multifd_queue_page(file, block, offset) < 0) { return -1; } - stat64_add(&ram_atomic_counters.normal, 1); + stat64_add(&ram_counters.normal, 1); return 1; } @@ -1497,7 +1490,7 @@ update_compress_thread_counts(const CompressParam *param, int bytes_xmit) ram_transferred_add(bytes_xmit); if (param->zero_page) { - stat64_add(&ram_atomic_counters.duplicate, 1); + stat64_add(&ram_counters.duplicate, 1); return; } @@ -2632,9 +2625,9 @@ void acct_update_position(QEMUFile *f, size_t size, bool zero) uint64_t pages = size / TARGET_PAGE_SIZE; if (zero) { - stat64_add(&ram_atomic_counters.duplicate, pages); + stat64_add(&ram_counters.duplicate, pages); } else { - stat64_add(&ram_atomic_counters.normal, pages); + stat64_add(&ram_counters.normal, pages); ram_transferred_add(size); qemu_file_credit_transfer(f, size); } |