⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

TlbFlushBatch

Struct TlbFlushBatch 

Source
pub struct TlbFlushBatch { /* private fields */ }
Expand description

Batched TLB flush accumulator.

Collects up to MAX_BATCH virtual addresses for individual flushes. If more than MAX_BATCH addresses are accumulated, the entire TLB is flushed on commit. This reduces the overhead of multiple individual invlpg instructions in loops (e.g., munmap of many pages).

Implementations§

Source§

impl TlbFlushBatch

Source

pub const fn new() -> Self

Create a new empty batch.

Source

pub fn add(&mut self, vaddr: u64)

Add an address to the batch. Does not flush yet.

Source

pub fn flush(self)

Flush all accumulated addresses. If > MAX_BATCH, do a full TLB flush.

Source

pub fn len(&self) -> usize

Number of addresses accumulated

Source

pub fn is_empty(&self) -> bool

Is the batch empty?

Source

pub fn flush_with_shootdown(self)

Flush locally and broadcast TLB shootdown IPI to all other CPUs.

On single-CPU systems the IPI is a no-op (no other CPUs to notify). On multi-CPU systems, remote CPUs receive vector 49 and flush their entire TLB in the handler.

Trait Implementations§

Source§

impl Default for TlbFlushBatch

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for TlbFlushBatch

§

impl RefUnwindSafe for TlbFlushBatch

§

impl Send for TlbFlushBatch

§

impl Sync for TlbFlushBatch

§

impl Unpin for TlbFlushBatch

§

impl UnwindSafe for TlbFlushBatch

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.