migration: Make postcopy_requests atomic

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
Juan Quintela 2023-04-11 18:04:59 +02:00
parent 536b5a4e56
commit 3c764f9b2b
3 changed files with 4 additions and 3 deletions

View File

@ -1152,7 +1152,8 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)
stat64_get(&ram_counters.dirty_sync_count);
info->ram->dirty_sync_missed_zero_copy =
stat64_get(&ram_counters.dirty_sync_missed_zero_copy);
info->ram->postcopy_requests = ram_counters.postcopy_requests;
info->ram->postcopy_requests =
stat64_get(&ram_counters.postcopy_requests);
info->ram->page_size = page_size;
info->ram->multifd_bytes = stat64_get(&ram_counters.multifd_bytes);
info->ram->pages_per_second = s->pages_per_second;

View File

@ -2169,7 +2169,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len)
RAMBlock *ramblock;
RAMState *rs = ram_state;
ram_counters.postcopy_requests++;
stat64_add(&ram_counters.postcopy_requests, 1);
RCU_READ_LOCK_GUARD();
if (!rbname) {

View File

@ -49,7 +49,7 @@ typedef struct {
Stat64 multifd_bytes;
Stat64 normal;
Stat64 postcopy_bytes;
int64_t postcopy_requests;
Stat64 postcopy_requests;
Stat64 precopy_bytes;
int64_t remaining;
Stat64 transferred;