[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/18] migration: Make dirty_pages_rate atomic
From: |
Juan Quintela |
Subject: |
[PULL 17/18] migration: Make dirty_pages_rate atomic |
Date: |
Thu, 27 Apr 2023 17:22:33 +0200 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
Don't use __nocheck() variants
Use stat64_get()
---
migration/migration.c | 6 ++++--
migration/ram.c | 5 +++--
migration/ram.h | 2 +-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 3adcdfe286..9367bb2afc 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -958,7 +958,8 @@ static void populate_ram_info(MigrationInfo *info,
MigrationState *s)
if (s->state != MIGRATION_STATUS_COMPLETED) {
info->ram->remaining = ram_bytes_remaining();
- info->ram->dirty_pages_rate = ram_counters.dirty_pages_rate;
+ info->ram->dirty_pages_rate =
+ stat64_get(&ram_counters.dirty_pages_rate);
}
}
@@ -2689,7 +2690,8 @@ static void migration_update_counters(MigrationState *s,
* if we haven't sent anything, we don't want to
* recalculate. 10000 is a small enough number for our purposes
*/
- if (ram_counters.dirty_pages_rate && transferred > 10000) {
+ if (stat64_get(&ram_counters.dirty_pages_rate) &&
+ transferred > 10000) {
s->expected_downtime = ram_counters.remaining / bandwidth;
}
diff --git a/migration/ram.c b/migration/ram.c
index e9dcda8b9d..5846f6e27f 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1130,8 +1130,9 @@ static void migration_update_rates(RAMState *rs, int64_t
end_time)
double compressed_size;
/* calculate period counters */
- ram_counters.dirty_pages_rate = rs->num_dirty_pages_period * 1000
- / (end_time - rs->time_last_bitmap_sync);
+ stat64_set(&ram_counters.dirty_pages_rate,
+ rs->num_dirty_pages_period * 1000 /
+ (end_time - rs->time_last_bitmap_sync));
if (!page_count) {
return;
diff --git a/migration/ram.h b/migration/ram.h
index a6e0d70226..f189cc79f8 100644
--- a/migration/ram.h
+++ b/migration/ram.h
@@ -41,7 +41,7 @@
* one thread).
*/
typedef struct {
- int64_t dirty_pages_rate;
+ Stat64 dirty_pages_rate;
Stat64 dirty_sync_count;
Stat64 dirty_sync_missed_zero_copy;
Stat64 downtime_bytes;
--
2.40.0
- [PULL 00/18] Migration 20230427 patches, Juan Quintela, 2023/04/27
- [PULL 04/18] migration: Create migrate_downtime_limit() function, Juan Quintela, 2023/04/27
- [PULL 10/18] migration: Create migrate_tls_hostname() function, Juan Quintela, 2023/04/27
- [PULL 06/18] migration: Move block_cleanup_parameters() to options.c, Juan Quintela, 2023/04/27
- [PULL 01/18] multifd: Fix the number of channels ready, Juan Quintela, 2023/04/27
- [PULL 17/18] migration: Make dirty_pages_rate atomic,
Juan Quintela <=
- [PULL 14/18] multifd: Protect multifd_send_sync_main() calls, Juan Quintela, 2023/04/27
- [PULL 13/18] multifd: Create property multifd-flush-after-each-section, Juan Quintela, 2023/04/27
- [PULL 16/18] stat64: Add stat64_set() operation, Juan Quintela, 2023/04/27
- [PULL 18/18] migration: Make dirty_bytes_last_sync atomic, Juan Quintela, 2023/04/27
- [PULL 05/18] migration: Move migrate_set_block_incremental() to options.c, Juan Quintela, 2023/04/27
- [PULL 07/18] migration: Remove MigrationState from block_cleanup_parameters(), Juan Quintela, 2023/04/27
- [PULL 15/18] multifd: Only flush once each full round of memory, Juan Quintela, 2023/04/27
- [PULL 11/18] migration: Create migrate_block_bitmap_mapping() function, Juan Quintela, 2023/04/27
- [PULL 09/18] migration: Create migrate_tls_authz() function, Juan Quintela, 2023/04/27
- [PULL 08/18] migration: Create migrate_tls_creds() function, Juan Quintela, 2023/04/27