tests: exercise memory reserve on the hugepage UFFD restore zone

Turn reserve=on for the hugepage-backed memory zone in the UFFD
snapshot/restore integration test. Hugepages are the most likely place
to want reserve (an over-committed huge page pool is exactly the case
that otherwise SIGBUSes the guest), so this is the natural test to give
the option real coverage, as suggested in review.

It exercises the reserve mmap path twice: once on the source VM boot and
once on the demand-paged restore. The existing skip guard already
requires the 256 free 2MiB pages this zone needs, and the source VM is
killed before the restore VM is started, so reserving from the pool
never has to back two VMs at once.

Assisted-by: Claude Code (Opus 4.8)
Signed-off-by: Ian Klemm <hi@ianklemm.de>
This commit is contained in:
Ian Klemm
2026-06-10 12:37:13 +01:00
committed by Rob Bradford
parent 8d05407799
commit e8e532faf3

View File

@@ -8678,9 +8678,16 @@ mod common_sequential {
return;
}
// reserve=on opts the hugepage-backed zone out of MAP_NORESERVE, so
// the 2MiB pages are reserved from the pool at mmap time. Hugepages
// are the most likely place to want this, and exercising it here keeps
// the reserve path covered across both the source boot and the
// demand-paged UFFD restore. The skip guard above already requires the
// 256 free pages this zone needs, and the source VM is killed before
// restore, so the pool only ever has to back one VM at a time.
snapshot_restore_common::_test_snapshot_restore_uffd(
"size=0",
&["id=mem0,size=512M,hugepages=on,hugepage_size=2M"],
&["id=mem0,size=512M,hugepages=on,hugepage_size=2M,reserve=on"],
480_000,
);
}