vm-migration: Optimize downtime by moving stop_dirty_log()

The larger the VM memory, the greater the memory pressure, and the
greater the stop_dirty_log() overhead. Moving stop_dirty_log() outside
the downtime period can reduce downtime.

Signed-off-by: Jinrong Liang <cloudliang@tencent.com>
This commit is contained in:
Jinrong Liang
2025-03-18 10:24:05 +08:00
committed by Bo Chen
parent 4c27572b87
commit 9d93df4c8f
+5 -3
View File
@@ -1209,9 +1209,6 @@ impl Vmm {
// Send last batch of dirty pages // Send last batch of dirty pages
Self::vm_maybe_send_dirty_pages(vm, &mut socket)?; Self::vm_maybe_send_dirty_pages(vm, &mut socket)?;
// Stop logging dirty pages
vm.stop_dirty_log()?;
} }
// Capture snapshot and send it // Capture snapshot and send it
let vm_snapshot = vm.snapshot()?; let vm_snapshot = vm.snapshot()?;
@@ -1231,6 +1228,11 @@ impl Vmm {
MigratableError::MigrateSend(anyhow!("Error completing migration")), MigratableError::MigrateSend(anyhow!("Error completing migration")),
)?; )?;
// Stop logging dirty pages
if !send_data_migration.local {
vm.stop_dirty_log()?;
}
info!("Migration complete"); info!("Migration complete");
// Let every Migratable object know about the migration being complete // Let every Migratable object know about the migration being complete