Skip to main content

PerCpuSlab

Struct PerCpuSlab 

Source
pub struct PerCpuSlab<const PAGE_SIZE: usize = 4096> { /* private fields */ }
Expand description

Default per-CPU slab wrapper used by EII integrators.

Implementations§

Source§

impl<const PAGE_SIZE: usize> PerCpuSlab<PAGE_SIZE>

Source

pub const fn new(cpu_id: u16) -> Self

Create an empty per-CPU slab wrapper for cpu_id.

Source

pub fn reset(&self)

Reset the inner slab allocator to an empty state.

Source

pub const fn cpu_id(&self) -> usize

Return this slab’s logical CPU id.

Source

pub fn alloc(&self, layout: Layout) -> AllocResult<SlabAllocResult>

Allocate one object.

Source

pub fn add_slab(&self, size_class: SizeClass, base: usize, bytes: usize)

Register a freshly allocated slab page.

Source

pub fn dealloc_local( &self, ptr: NonNull<u8>, layout: Layout, ) -> SlabDeallocResult

Free an object on the owner CPU path.

Source

pub fn dealloc_remote(&self, ptr: NonNull<u8>)

Queue an object onto this slab’s remote-free list.

Trait Implementations§

Source§

impl<const PAGE_SIZE: usize> SlabTrait for PerCpuSlab<PAGE_SIZE>

Source§

fn cpu_id(&self) -> usize

Logical CPU id this slab belongs to.
Source§

fn page_size(&self) -> usize

Page size used by this slab.
Source§

fn alloc(&self, layout: Layout) -> AllocResult<SlabAllocResult>

Allocate one object.
Source§

fn add_slab(&self, size_class: SizeClass, base: usize, bytes: usize)

Register a freshly allocated slab page.
Source§

fn dealloc_local(&self, ptr: NonNull<u8>, layout: Layout) -> SlabDeallocResult

Free an object on the owner CPU path.
Source§

fn dealloc_remote(&self, ptr: NonNull<u8>)

Free an object on the remote CPU path.

Auto Trait Implementations§

§

impl<const PAGE_SIZE: usize = 4096> !Freeze for PerCpuSlab<PAGE_SIZE>

§

impl<const PAGE_SIZE: usize = 4096> !RefUnwindSafe for PerCpuSlab<PAGE_SIZE>

§

impl<const PAGE_SIZE: usize> Send for PerCpuSlab<PAGE_SIZE>

§

impl<const PAGE_SIZE: usize> Sync for PerCpuSlab<PAGE_SIZE>

§

impl<const PAGE_SIZE: usize> Unpin for PerCpuSlab<PAGE_SIZE>

§

impl<const PAGE_SIZE: usize> UnsafeUnpin for PerCpuSlab<PAGE_SIZE>

§

impl<const PAGE_SIZE: usize> UnwindSafe for PerCpuSlab<PAGE_SIZE>

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
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, 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.