Skip to content

Commit a8f5d78

Browse files
committed
fix: Free page hinting kick on restore
Move the reset logic for post restore hinting to the kick method. This will reset the command back to DONE to ensure the memory is freed on restore. Previously this was done on activate which meant is was triggered on boot creating an uneeded interrupt. Signed-off-by: Jack Thomson <[email protected]>
1 parent 07ebf7e commit a8f5d78

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/vmm/src/devices/virtio/balloon/device.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -946,12 +946,6 @@ impl VirtioDevice for Balloon {
946946
self.update_timer_state();
947947
}
948948

949-
// On activate ensure hint cmd is reset to FREE_PAGE_HINT_DONE
950-
if self.is_activated() && self.free_page_hinting() {
951-
self.update_free_page_hint_cmd(FREE_PAGE_HINT_DONE)
952-
.map_err(|_| ActivateError::EventFd)?;
953-
}
954-
955949
Ok(())
956950
}
957951

@@ -965,6 +959,10 @@ impl VirtioDevice for Balloon {
965959
// Stats queue doesn't need kicking as it is notified via a `timer_fd`.
966960
if self.is_activated() {
967961
info!("kick balloon {}.", self.id());
962+
if self.free_page_hinting() {
963+
// On restore we reset back to DONE to ensure everythign is freed
964+
self.update_free_page_hint_cmd(FREE_PAGE_HINT_DONE);
965+
}
968966
self.process_virtio_queues();
969967
}
970968
}

0 commit comments

Comments
 (0)