Problem
CH VM creation still auto-enables hugepages whenever the host has them:
// hypervisor/cloudhypervisor/args.go:52
Memory: chMemory{Size: mem, HugePages: utils.DetectHugePages(), Shared: rec.Config.SharedMemory},
Consequence chain:
- Every snapshot taken from such a VM is stamped
hugepages=true in its config.json.
validateRestoreMode rejects --restore-mode mmap for hugepages/shared snapshots (CH would otherwise silently downgrade to eager copy), so on a hugepages-configured host the CoW mmap restore path is structurally unavailable for every golden built there.
- All clones of those goldens are forced into eager-copy restore. Eager copy is already measured ~6x slower than mmap for a single restore (noted in
restoreVM), and under a burst it turns into a guest-RAM memcpy per clone that saturates memory bandwidth — the main driver of the known burst-clone latency blowup, since extraction is already cheap (memory-range-* hardlinked, COW reflinked).
The host's hugepages configuration silently deciding guest memory policy is also a policy leak: whether a VM trades hibernate/clone-path speed for TLB benefits should be the caller's explicit choice, not an environment probe.
Precedent: #156 removed hugepages from FC entirely because FC's File restore backend cannot map hugetlbfs-backed snapshots at all. CH tolerates them (via eager copy) but pays the fast-path loss above.
Proposal
- Drop
utils.DetectHugePages() from the CH memory config; add an explicit --hugepages create flag (same shape as the existing --shared-memory, fixed for VM lifetime). Default off.
- Companion change (separate PR candidate): default CH clones to mmap restore when the snapshot's memory config qualifies (plain private-anon — no hugepages, no shared);
cloneAfterExtract already parses config.json, and the hardlinked memory-range files keep the backing inode alive for the mapping's lifetime. Explicit --restore-mode keeps overriding.
Validation plan
Testbed burst64 three-way comparison against one golden rebuilt without hugepages: eager copy vs --restore-mode mmap vs mmap + sqlite meta engine, recording per-step timings and p50/p99 clone latency, plus a hibernate/restore regression pass for hugepages goldens (must keep working via eager copy).
Problem
CH VM creation still auto-enables hugepages whenever the host has them:
Consequence chain:
hugepages=truein its config.json.validateRestoreModerejects--restore-mode mmapfor hugepages/shared snapshots (CH would otherwise silently downgrade to eager copy), so on a hugepages-configured host the CoW mmap restore path is structurally unavailable for every golden built there.restoreVM), and under a burst it turns into a guest-RAM memcpy per clone that saturates memory bandwidth — the main driver of the known burst-clone latency blowup, since extraction is already cheap (memory-range-* hardlinked, COW reflinked).The host's hugepages configuration silently deciding guest memory policy is also a policy leak: whether a VM trades hibernate/clone-path speed for TLB benefits should be the caller's explicit choice, not an environment probe.
Precedent: #156 removed hugepages from FC entirely because FC's File restore backend cannot map hugetlbfs-backed snapshots at all. CH tolerates them (via eager copy) but pays the fast-path loss above.
Proposal
utils.DetectHugePages()from the CH memory config; add an explicit--hugepagescreate flag (same shape as the existing--shared-memory, fixed for VM lifetime). Default off.cloneAfterExtractalready parses config.json, and the hardlinked memory-range files keep the backing inode alive for the mapping's lifetime. Explicit--restore-modekeeps overriding.Validation plan
Testbed burst64 three-way comparison against one golden rebuilt without hugepages: eager copy vs
--restore-mode mmapvs mmap + sqlite meta engine, recording per-step timings and p50/p99 clone latency, plus a hibernate/restore regression pass for hugepages goldens (must keep working via eager copy).