PerCpuMemoryPool

Struct PerCpuMemoryPool 

Source
#[repr(align(64))]
pub struct PerCpuMemoryPool { pub cpu_id: CpuId, pub small_stack_pool: LockFreePool<Stack>, pub medium_stack_pool: LockFreePool<Stack>, pub large_stack_pool: LockFreePool<Stack>, pub thread_object_pool: LockFreePool<ThreadObjectSlot>, pub sync_object_pool: LockFreePool<SyncObjectSlot>, pub stats: CacheLinePadded<PoolStats>, pub fallback_pool: AtomicPtr<GlobalMemoryPool>, pub config: PoolConfig, }
Expand description

Per-CPU memory pool for lock-free allocation.

Fields§

§cpu_id: CpuId

CPU ID this pool serves

§small_stack_pool: LockFreePool<Stack>

Stack pools by size class (frequently accessed)

§medium_stack_pool: LockFreePool<Stack>§large_stack_pool: LockFreePool<Stack>§thread_object_pool: LockFreePool<ThreadObjectSlot>

General-purpose object pools

§sync_object_pool: LockFreePool<SyncObjectSlot>§stats: CacheLinePadded<PoolStats>

Pool statistics (cache line padded)

§fallback_pool: AtomicPtr<GlobalMemoryPool>

Emergency fallback pool pointer (for cross-CPU allocation)

§config: PoolConfig

Pool configuration

Implementations§

Source§

impl PerCpuMemoryPool

Source

pub fn new(cpu_id: CpuId, config: PoolConfig) -> Self

Create a new per-CPU memory pool.

Source

pub fn allocate_stack(&self, size_class: StackSizeClass) -> Option<Stack>

Allocate a stack from the appropriate pool.

Source

pub fn deallocate_stack(&self, stack: Stack, size_class: StackSizeClass)

Return a stack to the appropriate pool.

Source

pub fn needs_refill(&self) -> bool

Check if pool needs refilling.

Source

pub fn trigger_refill(&self)

Trigger background refill of pools.

Source

pub fn get_utilization(&self) -> PoolUtilization

Get pool utilization statistics.

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