migration: Make dirty_sync_missed_zero_copy atomic
authorJuan Quintela <quintela@redhat.com>
Tue, 11 Apr 2023 15:33:56 +0000 (17:33 +0200)
committerJuan Quintela <quintela@redhat.com>
Mon, 24 Apr 2023 09:28:57 +0000 (11:28 +0200)
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
migration/migration.c
migration/multifd.c
migration/ram.c
migration/ram.h

index c3debe71f6f4da2fc88ee30ac1718f0174009cb3..66e5197b776fef7537ed5ebea9c964a1449059a3 100644 (file)
@@ -1150,7 +1150,7 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)
     info->ram->mbps = s->mbps;
     info->ram->dirty_sync_count = ram_counters.dirty_sync_count;
     info->ram->dirty_sync_missed_zero_copy =
-            ram_counters.dirty_sync_missed_zero_copy;
+        stat64_get(&ram_counters.dirty_sync_missed_zero_copy);
     info->ram->postcopy_requests = ram_counters.postcopy_requests;
     info->ram->page_size = page_size;
     info->ram->multifd_bytes = stat64_get(&ram_counters.multifd_bytes);
index 1c992abf53e701a3f57d1c137dd8df1a60bdad9d..903df2117bf2ca6055c463aadcd21c0276464ae5 100644 (file)
@@ -576,7 +576,7 @@ static int multifd_zero_copy_flush(QIOChannel *c)
         return -1;
     }
     if (ret == 1) {
-        dirty_sync_missed_zero_copy();
+        stat64_add(&ram_counters.dirty_sync_missed_zero_copy, 1);
     }
 
     return ret;
index 71320ed27ae9bcb5586ae72481d5ee70990f7055..93e0a48af4b26c74300cf67fead5e060d0f40fd0 100644 (file)
@@ -472,11 +472,6 @@ void ram_transferred_add(uint64_t bytes)
     stat64_add(&ram_counters.transferred, bytes);
 }
 
-void dirty_sync_missed_zero_copy(void)
-{
-    ram_counters.dirty_sync_missed_zero_copy++;
-}
-
 struct MigrationOps {
     int (*ram_save_target_page)(RAMState *rs, PageSearchStatus *pss);
 };
index ed703913179336af04bd95716bf22f80930ebcbf..2170c55e67bb0fe81ce7b812172b1c4cc4dd717e 100644 (file)
@@ -43,7 +43,7 @@
 typedef struct {
     int64_t dirty_pages_rate;
     int64_t dirty_sync_count;
-    uint64_t dirty_sync_missed_zero_copy;
+    Stat64 dirty_sync_missed_zero_copy;
     uint64_t downtime_bytes;
     Stat64 duplicate;
     Stat64 multifd_bytes;
@@ -114,6 +114,4 @@ void ram_write_tracking_prepare(void);
 int ram_write_tracking_start(void);
 void ram_write_tracking_stop(void);
 
-void dirty_sync_missed_zero_copy(void);
-
 #endif