Skip to content

Commit a4fbd0a

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 (it is unconditionally available since linux 4.10). Signed-off-by: Patrick Roy <[email protected]>
1 parent cd6300c commit a4fbd0a

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
@@ -392,9 +392,6 @@ pub fn restore_from_snapshot(
392392
mem_backend_path,
393393
mem_state,
394394
track_dirty_pages,
395-
// We enable the UFFD_FEATURE_EVENT_REMOVE feature only if a balloon device
396-
// is present in the microVM state.
397-
microvm_state.device_states.balloon_device.is_some(),
398395
vm_resources.machine_config.huge_pages,
399396
)
400397
.map_err(RestoreFromSnapshotGuestMemoryError::Uffd)?,
@@ -478,19 +475,14 @@ fn guest_memory_from_uffd(
478475
mem_uds_path: &Path,
479476
mem_state: &GuestMemoryState,
480477
track_dirty_pages: bool,
481-
enable_balloon: bool,
482478
huge_pages: HugePageConfig,
483479
) -> Result<(Vec<GuestRegionMmap>, Option<Uffd>), GuestMemoryFromUffdError> {
484480
let (guest_memory, backend_mappings) =
485481
create_guest_memory(mem_state, track_dirty_pages, huge_pages)?;
486482

487483
let mut uffd_builder = UffdBuilder::new();
488484

489-
if enable_balloon {
490-
// We enable this so that the page fault handler can add logic
491-
// for treating madvise(MADV_DONTNEED) events triggerd by balloon inflation.
492-
uffd_builder.require_features(FeatureFlags::EVENT_REMOVE);
493-
}
485+
uffd_builder.require_features(FeatureFlags::EVENT_REMOVE);
494486

495487
let uffd = uffd_builder
496488
.close_on_exec(true)

0 commit comments

Comments
 (0)