diff options
| author | Hyman Huang <yong.huang@smartx.com> | 2024-10-17 14:42:54 +0800 |
|---|---|---|
| committer | Peter Xu <peterx@redhat.com> | 2024-10-31 15:48:18 -0400 |
| commit | 52ac968ab28b2e1eee2e083f19f2a70fdece5a2e (patch) | |
| tree | 9ccd48373aeb80ad9c269d5c41dac8f5459d2ff3 /migration/migration.c | |
| parent | 6a39ba7cab67da05b91e215142ce5781e77e5d9f (diff) | |
| download | focaccia-qemu-52ac968ab28b2e1eee2e083f19f2a70fdece5a2e.tar.gz focaccia-qemu-52ac968ab28b2e1eee2e083f19f2a70fdece5a2e.zip | |
migration: Support periodic RAMBlock dirty bitmap sync
When VM is configured with huge memory, the current throttle logic doesn't look like to scale, because migration_trigger_throttle() is only called for each iteration, so it won't be invoked for a long time if one iteration can take a long time. The periodic dirty sync aims to fix the above issue by synchronizing the ramblock from remote dirty bitmap and, when necessary, triggering the CPU throttle multiple times during a long iteration. This is a trade-off between synchronization overhead and CPU throttle impact. Signed-off-by: Hyman Huang <yong.huang@smartx.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/f61f1b3653f2acf026901103e1c73d157d38b08f.1729146786.git.yong.huang@smartx.com [peterx: make prev_cnt global, and reset for each migration] Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration/migration.c')
| -rw-r--r-- | migration/migration.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/migration/migration.c b/migration/migration.c index 64c1d0c1db..9bcc9db4fb 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3297,12 +3297,17 @@ static MigIterateState migration_iteration_run(MigrationState *s) static void migration_iteration_finish(MigrationState *s) { - /* If we enabled cpu throttling for auto-converge, turn it off. */ + bql_lock(); + + /* + * If we enabled cpu throttling for auto-converge, turn it off. + * Stopping CPU throttle should be serialized by BQL to avoid + * racing for the throttle_dirty_sync_timer. + */ if (migrate_auto_converge()) { cpu_throttle_stop(); } - bql_lock(); switch (s->state) { case MIGRATION_STATUS_COMPLETED: runstate_set(RUN_STATE_POSTMIGRATE); @@ -3520,6 +3525,11 @@ static void *migration_thread(void *opaque) qemu_savevm_send_colo_enable(s->to_dst_file); } + if (migrate_auto_converge()) { + /* Start RAMBlock dirty bitmap sync timer */ + cpu_throttle_dirty_sync_timer(true); + } + bql_lock(); ret = qemu_savevm_state_setup(s->to_dst_file, &local_err); bql_unlock(); |