Skip to main content

Vmalloc

Struct Vmalloc 

Source
struct Vmalloc {
    initialized: bool,
    subtree_ready: bool,
    arena_initialized: bool,
    bootstrap_frame: Option<PhysFrame>,
    free_head: *mut VmallocNode,
    alloc_head: *mut VmallocNode,
    node_pool_free: *mut VmallocNode,
    alloc_count: usize,
    allocated_pages: usize,
    metadata_pages: usize,
    fail_count: usize,
    last_failure: Option<VmallocFailureSnapshot>,
}

Fields§

§initialized: bool§subtree_ready: bool§arena_initialized: bool

True once the initial single-spanning free extent has been inserted. Replaces the ambiguous !free_head.is_null() || !alloc_head.is_null() guard that read as a free-space check rather than an init-state check.

§bootstrap_frame: Option<PhysFrame>

Bootstrap frame permanently mapped at VMALLOC_VIRT_START (arena page 0).

Keeping this mapping live anchors the intermediate page-table nodes (PDPT → PD → PT) so they are present in the canonical kernel L4 table and inherited by every address space created after init(). The frame must never be freed while the kernel is running.

§free_head: *mut VmallocNode§alloc_head: *mut VmallocNode§node_pool_free: *mut VmallocNode§alloc_count: usize§allocated_pages: usize§metadata_pages: usize§fail_count: usize§last_failure: Option<VmallocFailureSnapshot>

Implementations§

Source§

impl Vmalloc

Source

const fn new() -> Self

Source

fn record_failure( &mut self, size: usize, pages: usize, error: VmallocError, ) -> VmallocError

Source

unsafe fn refill_node_pool( &mut self, token: &IrqDisabledToken, ) -> Result<(), VmallocError>

Source

unsafe fn alloc_node( &mut self, token: &IrqDisabledToken, ) -> Result<*mut VmallocNode, VmallocError>

Source

unsafe fn release_node(&mut self, node: *mut VmallocNode)

Source

unsafe fn ensure_arena_ready( &mut self, token: &IrqDisabledToken, ) -> Result<(), VmallocError>

Source

unsafe fn reserve_range( &mut self, pages: usize, token: &IrqDisabledToken, ) -> Result<*mut VmallocNode, VmallocError>

Source

unsafe fn insert_alloc_node(&mut self, node: *mut VmallocNode)

Source

unsafe fn take_alloc_node_by_addr(&mut self, addr: u64) -> *mut VmallocNode

Source

unsafe fn insert_free_node_merge(&mut self, node: *mut VmallocNode)

Source

unsafe fn free_extent_count(&self) -> usize

Source

unsafe fn largest_free_extent_pages(&self) -> usize

Source

unsafe fn node_pool_free_count(&self) -> usize

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.