pub struct PagePoolAllocator { /* private fields */ }Expand description
A page allocator for memory.
Pages are allocated via the Self::alloc method and freed by dropping the
associated handle returned.
When an allocator is dropped, outstanding allocations for that device are left as-is in the pool. A new allocator can then be created with the same name. Exisitng allocations with that same device_name will be linked to the new allocator.
Implementations§
Source§impl PagePoolAllocator
 
impl PagePoolAllocator
Sourcepub fn alloc(
    &self,
    size_pages: NonZeroU64,
    tag: String,
) -> Result<PagePoolHandle, Error>
 
pub fn alloc( &self, size_pages: NonZeroU64, tag: String, ) -> Result<PagePoolHandle, Error>
Allocate contiguous pages from the page pool with the given tag. If a contiguous region of free pages is not available, then an error is returned.
Sourcepub fn restore_alloc(
    &self,
    base_pfn: u64,
    size_pages: NonZeroU64,
) -> Result<PagePoolHandle, Error>
 
pub fn restore_alloc( &self, base_pfn: u64, size_pages: NonZeroU64, ) -> Result<PagePoolHandle, Error>
Restore an allocation that was previously allocated in the pool. The base_pfn, size_pages, and device must match.
with_mapping specifies if a mapping should be created that can be used
via PagePoolHandle::mapping.
Sourcepub fn restore_pending_allocs(&self) -> Vec<PagePoolHandle>
 
pub fn restore_pending_allocs(&self) -> Vec<PagePoolHandle>
Restore all pending allocs