pub struct RamBackingRequest { /* private fields */ }Expand description
A request to allocate one RAM backing region (one memfd or anonymous allocation). For non-NUMA VMs, a single request covers all RAM. For NUMA VMs, one request per node with memory.
Construct via RamBackingRequest::new.
Implementations§
Source§impl RamBackingRequest
impl RamBackingRequest
Sourcepub fn new(ranges: Vec<MemoryRange>) -> Self
pub fn new(ranges: Vec<MemoryRange>) -> Self
Creates a new backing request covering the given GPA ranges.
The backing’s allocation size is the sum of the range lengths. Defaults to shared file-backed memory with no prefetch.
Sourcepub fn private_memory(self, enable: bool) -> Self
pub fn private_memory(self, enable: bool) -> Self
Use private anonymous memory instead of shared file-backed memory.
Sourcepub fn transparent_hugepages(self, enable: bool) -> Self
pub fn transparent_hugepages(self, enable: bool) -> Self
Enable Transparent Huge Pages (requires private_memory, Linux only).
Sourcepub fn hugepages(self, size: Option<u64>) -> Self
pub fn hugepages(self, size: Option<u64>) -> Self
Enable explicit hugetlb memfd backing with an optional size
override (default: 2 MB). Incompatible with private_memory.
Sourcepub fn existing_mappable(self, mappable: Mappable) -> Self
pub fn existing_mappable(self, mappable: Mappable) -> Self
Reuse an existing file-backed memory handle (restore path). When set, no new allocation is performed for this backing.
Sourcepub fn host_numa_node(self, node: Option<u32>) -> Self
pub fn host_numa_node(self, node: Option<u32>) -> Self
Bind this backing’s memory to a specific host NUMA node
(Linux: mbind(MPOL_BIND), Windows: CreateFileMappingNuma for
large-page sections and MemExtendedParameterNumaNode otherwise).
Only supported on Linux and Windows; returns
MemoryBuildError::HostNumaNodeUnsupportedPlatform at build time on
other targets.