Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions vmm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,12 @@ impl Vmm {
postponed_lifecycle_event: &Mutex<Option<PostMigrationLifecycleEvent>>,
return_if_cancelled_cb: &impl Fn(&mut SocketStream) -> result::Result<(), MigratableError>,
) -> result::Result<MemoryRangeTable /* remaining */, MigratableError> {
let total_memory_size_bytes = vm
Comment thread
phip1611 marked this conversation as resolved.
.memory_range_table()?
.ranges()
.iter()
.map(|range| range.length)
.sum::<u64>();
let update_migration_progress = |s: &mut MemoryMigrationContext, vm: &Vm| {
let mut lock = MIGRATION_PROGRESS_SNAPSHOT.lock().unwrap();
lock.as_mut()
Expand All @@ -1604,8 +1610,8 @@ impl Vmm {
MigrationStateOngoingPhase::MemoryPrecopy,
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_transmission_bps: s.bandwidth_bytes_per_second as u64,
Comment thread
phip1611 marked this conversation as resolved.
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
Expand Down Expand Up @@ -1652,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);
Comment thread
Coffeeri marked this conversation as resolved.

// Send the current dirty pages
let transfer_begin = Instant::now();
mem_send.send_memory(iteration_table, socket, return_if_cancelled_cb)?;
Expand Down
Loading