Struct swap::page_handler::SwapInContext
source · pub struct SwapInContext<'a> {
ctx: &'a Mutex<PageHandleContext<'a>>,
cur_staging: usize,
}Expand description
Context for swap-in operation.
This holds cursor of indices in the regions for each step for optimization.
Fields§
§ctx: &'a Mutex<PageHandleContext<'a>>§cur_staging: usizeImplementations§
source§impl SwapInContext<'_>
impl SwapInContext<'_>
sourcepub fn swap_in(&mut self, uffd: &Userfaultfd, max_size: usize) -> Result<usize>
pub fn swap_in(&mut self, uffd: &Userfaultfd, max_size: usize) -> Result<usize>
Swap in a chunk of consecutive pages from the staging memory and the swap file.
If there is no more pages present outside of the guest memory, this returns Ok(0).
Returns the count of swapped in pages.
§Arguments
uffd- the main Userfaultfd.max_size- the upper limit of the chunk size to swap into the guest memory at once. The chunk is splitted if it is bigger thanmax_size.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SwapInContext<'a>
impl<'a> RefUnwindSafe for SwapInContext<'a>
impl<'a> Send for SwapInContext<'a>
impl<'a> Sync for SwapInContext<'a>
impl<'a> Unpin for SwapInContext<'a>
impl<'a> UnwindSafe for SwapInContext<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more