hyperlight-dev / hyperlight-dev/hyperlight

Heuristic-based scratch zeroing strategy for snapshot restore

未关闭
#1,766 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
lifecycle/needs-review
主要语言
Rust
星标
4.7k
派生
208
平均合并
1 天 7 小时
30 天内合并 PR
47

描述

`HostSharedMemory::zero_or_replace()` currently uses a compile-time `#[cfg(target_os = "windows")]` check to decide whether to zero scratch in-place or replace it with a fresh demand-zero allocation. This works for the immediate problem (large scratch regions on WHP), but the real decision depends on the hypervisor and the size of the region, not just the platform.

There is a break-even point between zero-in-place (via `MADV_DONTNEED` or `fill(0)`) and delete+recreate (fresh `ExclusiveSharedMemory::new`) that varies by:
- Hypervisor (KVM, MSHV, WHP)
- Scratch region size
- Whether `MADV_DONTNEED` is available (KVM-only builds vs KVM+mshv3)

We should benchmark across these configurations and replace the compile-time platform check with a size-based heuristic. This would also allow MSHV builds on Linux to benefit from the fresh-allocation path for large scratch regions.

Ref: #1765

贡献指南

打开贡献指南

调研方向

Start with HostSharedMemory::zero_or_replace() and read the context in #1765. Benchmark zero-in-place versus delete-and-recreate across KVM, MSHV, and WHP, varying scratch-region sizes and MADV_DONTNEED availability. Done means the compile-time Windows check is replaced by a size-based heuristic that also benefits large scratch regions in MSHV Linux builds.

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
infrastructure, performance
Issue 类型
重构
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。