Skip to content

Commit d11864a

Browse files
committed
virtio-balloon: Add free page hinting
Free page hinting is a mechanism which allows the guest driver to report ranges of pages to the host device. A "hinting" run is triggered by the device by issuing a new command id in the config space, after the update to the id the device will hint ranges to the host which are unused. Once the driver has exhausted all free ranges it notifies the device the run has completed. The device can then issue another command allowing the guest to reclaim these pages. Adding support for hinting the firecracker balloon device, we offer three points to manage the device; first to start a run, second to monitor the status and a final to issue the command to allow the guest to reclaim pages. To note, there is a potential condition in the linux driver which would allow a range to be reclaimed in an oom scenario before we remove the range. Signed-off-by: Jack Thomson <jackabt@amazon.com>
1 parent c4d975a commit d11864a

File tree

11 files changed

+320
-43
lines changed

11 files changed

+320
-43
lines changed

src/vmm/src/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,7 @@ pub(crate) mod tests {
12311231
amount_mib: 0,
12321232
deflate_on_oom: false,
12331233
stats_polling_interval_s: 0,
1234+
free_page_hinting: false,
12341235
free_page_reporting: false,
12351236
};
12361237

src/vmm/src/device_manager/pci_mngr.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ mod tests {
645645
amount_mib: 123,
646646
deflate_on_oom: false,
647647
stats_polling_interval_s: 1,
648+
free_page_hinting: false,
648649
free_page_reporting: false,
649650
};
650651
insert_balloon_device(&mut vmm, &mut cmdline, &mut event_manager, balloon_cfg);
@@ -730,6 +731,7 @@ mod tests {
730731
"amount_mib": 123,
731732
"deflate_on_oom": false,
732733
"stats_polling_interval_s": 1,
734+
"free_page_hinting": false,
733735
"free_page_reporting": false
734736
}},
735737
"drives": [

src/vmm/src/device_manager/persist.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ mod tests {
669669
amount_mib: 123,
670670
deflate_on_oom: false,
671671
stats_polling_interval_s: 1,
672+
free_page_hinting: false,
672673
free_page_reporting: false,
673674
};
674675
insert_balloon_device(&mut vmm, &mut cmdline, &mut event_manager, balloon_cfg);
@@ -750,6 +751,7 @@ mod tests {
750751
"amount_mib": 123,
751752
"deflate_on_oom": false,
752753
"stats_polling_interval_s": 1,
754+
"free_page_hinting": false,
753755
"free_page_reporting": false
754756
}},
755757
"drives": [

0 commit comments

Comments
 (0)