From f2fe3ff079b1a1dfc5bb919d887cb787ce32efcf Mon Sep 17 00:00:00 2001 From: Oliver Anderson Date: Wed, 27 May 2026 12:30:32 +0200 Subject: [PATCH 1/3] vmm: Fix memory_bytes_total value in do_memory_iterations Signed-off-by: Oliver Anderson On-behalf-of: SAP oliver.anderson@sap.com --- vmm/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 0811b23db..56033cc5a 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -1596,6 +1596,12 @@ impl Vmm { postponed_lifecycle_event: &Mutex>, return_if_cancelled_cb: &impl Fn(&mut SocketStream) -> result::Result<(), MigratableError>, ) -> result::Result { + let total_memory_size_bytes = vm + .memory_range_table()? + .ranges() + .iter() + .map(|range| range.length) + .sum::(); let update_migration_progress = |s: &mut MemoryMigrationContext, vm: &Vm| { let mut lock = MIGRATION_PROGRESS_SNAPSHOT.lock().unwrap(); lock.as_mut() @@ -1605,7 +1611,7 @@ impl Vmm { Some(MemoryTransmissionInfo { memory_iteration: s.iteration as u64, memory_transmission_bps: s.current_iteration_total_bytes, - memory_bytes_total: s.bandwidth_bytes_per_second as u64, + memory_bytes_total: total_memory_size_bytes, memory_bytes_transmitted: s.total_sent_bytes, memory_pages_4k_transmitted: s.total_sent_bytes.div_ceil(PAGE_SIZE as u64), memory_pages_4k_remaining_iteration: s From 3104fa6272ef80efbaf24ae44f0e63d34f94aa42 Mon Sep 17 00:00:00 2001 From: Oliver Anderson Date: Wed, 27 May 2026 12:39:03 +0200 Subject: [PATCH 2/3] vmm: Fix memory_transmission_bps value in do_memory_iterations Signed-off-by: Oliver Anderson On-behalf-of: SAP oliver.anderson@sap.com --- vmm/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 56033cc5a..88b5ff5a0 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -1610,7 +1610,7 @@ impl Vmm { MigrationStateOngoingPhase::MemoryPrecopy, Some(MemoryTransmissionInfo { memory_iteration: s.iteration as u64, - memory_transmission_bps: s.current_iteration_total_bytes, + memory_transmission_bps: s.bandwidth_bytes_per_second as u64, memory_bytes_total: total_memory_size_bytes, memory_bytes_transmitted: s.total_sent_bytes, memory_pages_4k_transmitted: s.total_sent_bytes.div_ceil(PAGE_SIZE as u64), From ec552e368bd2dfe68f4966a44426694259c2f545 Mon Sep 17 00:00:00 2001 From: Oliver Anderson Date: Wed, 27 May 2026 12:43:25 +0200 Subject: [PATCH 3/3] vmm: Remove duplicated update_migration_progress in do_memory_iterations Signed-off-by: Oliver Anderson On-behalf-of: SAP oliver.anderson@sap.com --- vmm/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 88b5ff5a0..c94eee40e 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -1658,16 +1658,13 @@ impl Vmm { }; ctx.update_metrics_before_transfer(iteration_begin, &iteration_table); - // Update before we might exit the loop. + // Update before we either exit the loop or transfer memory update_migration_progress(ctx, vm); if is_converged(ctx)? { info!("Precopy converged: {ctx}"); break Ok(iteration_table); } - // Update with new metrics before transmission. - update_migration_progress(ctx, vm); - // Send the current dirty pages let transfer_begin = Instant::now(); mem_send.send_memory(iteration_table, socket, return_if_cancelled_cb)?;