Skip to content

Commit 0dc15d1

Browse files
committed
uffd: unconditionally enable UFFD_FEATURE_EVENT_REMOVE
Only enabling it when a balloon device is present doesn't really gain us anything, because the only time this feature is checked in the kernel is as part of madvise handling - but without balloon devices we wont ever call madvise, so it makes no difference whether we enabled the feature or not. Signed-off-by: Patrick Roy <[email protected]>
1 parent 1afb6ad commit 0dc15d1

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/vmm/src/persist.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,6 @@ pub fn restore_from_snapshot(
468468
mem_backend_path,
469469
mem_state,
470470
track_dirty_pages,
471-
// We enable the UFFD_FEATURE_EVENT_REMOVE feature only if a balloon device
472-
// is present in the microVM state.
473-
microvm_state.device_states.balloon_device.is_some(),
474471
vm_resources.machine_config.huge_pages,
475472
)
476473
.map_err(RestoreFromSnapshotGuestMemoryError::Uffd)?,
@@ -554,19 +551,14 @@ fn guest_memory_from_uffd(
554551
mem_uds_path: &Path,
555552
mem_state: &GuestMemoryState,
556553
track_dirty_pages: bool,
557-
enable_balloon: bool,
558554
huge_pages: HugePageConfig,
559555
) -> Result<(Vec<GuestRegionMmap>, Option<Uffd>), GuestMemoryFromUffdError> {
560556
let (guest_memory, backend_mappings) =
561557
create_guest_memory(mem_state, track_dirty_pages, huge_pages)?;
562558

563559
let mut uffd_builder = UffdBuilder::new();
564560

565-
if enable_balloon {
566-
// We enable this so that the page fault handler can add logic
567-
// for treating madvise(MADV_DONTNEED) events triggerd by balloon inflation.
568-
uffd_builder.require_features(FeatureFlags::EVENT_REMOVE);
569-
}
561+
uffd_builder.require_features(FeatureFlags::EVENT_REMOVE);
570562

571563
let uffd = uffd_builder
572564
.close_on_exec(true)

0 commit comments

Comments
 (0)