#[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
impl PerCpuMemoryPool
Sourcepub fn new(cpu_id: CpuId, config: PoolConfig) -> Self
pub fn new(cpu_id: CpuId, config: PoolConfig) -> Self
Create a new per-CPU memory pool.
Sourcepub fn allocate_stack(&self, size_class: StackSizeClass) -> Option<Stack>
pub fn allocate_stack(&self, size_class: StackSizeClass) -> Option<Stack>
Allocate a stack from the appropriate pool.
Sourcepub fn deallocate_stack(&self, stack: Stack, size_class: StackSizeClass)
pub fn deallocate_stack(&self, stack: Stack, size_class: StackSizeClass)
Return a stack to the appropriate pool.
Sourcepub fn needs_refill(&self) -> bool
pub fn needs_refill(&self) -> bool
Check if pool needs refilling.
Sourcepub fn trigger_refill(&self)
pub fn trigger_refill(&self)
Trigger background refill of pools.
Sourcepub fn get_utilization(&self) -> PoolUtilization
pub fn get_utilization(&self) -> PoolUtilization
Get pool utilization statistics.
Auto Trait Implementations§
impl !Freeze for PerCpuMemoryPool
impl RefUnwindSafe for PerCpuMemoryPool
impl Send for PerCpuMemoryPool
impl Sync for PerCpuMemoryPool
impl Unpin for PerCpuMemoryPool
impl !UnwindSafe for PerCpuMemoryPool
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