Skip to main content

Module heap

Module heap 

Source

Structsยง

KernelHeapFailureSnapshot
LockedHeap
SlabDiagSnapshot
SlabPageHeader ๐Ÿ”’
Header at the base of each 4 KiB page dedicated to a slab class.
SlabState ๐Ÿ”’
Per-size-class partial-page lists.

Enumsยง

KernelHeapAllocError
KernelHeapBackend

Constantsยง

HEAP_POISON_ENABLED ๐Ÿ”’
MAX_SLAB_SIZE ๐Ÿ”’
Allocations with effective size above this threshold bypass the slab.
NUM_SLABS ๐Ÿ”’
POISON_BYTE ๐Ÿ”’
Byte pattern written to the body of freed slab blocks.
SLAB_CANARY ๐Ÿ”’
Canary word placed at the last 4 bytes of each slab block.
SLAB_HEADER_SIZE ๐Ÿ”’
Byte offset at which slab blocks begin within each slab page.
SLAB_NUM_CLASSES
Number of slab size classes.
SLAB_SIZES ๐Ÿ”’
Slab block sizes chosen to bound internal fragmentation to ~25% worst-case (average ~12%) instead of 50% with pure power-of-two classes.

Staticsยง

HEAP_ALLOCATOR ๐Ÿ”’
LAST_HEAP_FAILURE ๐Ÿ”’
SLAB_ALLOC ๐Ÿ”’
SLAB_PAGES_ALLOCATED ๐Ÿ”’
Total buddy pages ever handed to the slab allocator.
SLAB_PAGES_RECLAIMED ๐Ÿ”’
Total buddy pages ever returned from the slab allocator (fully-empty reclaim).

Functionsยง

alloc_error_handler ๐Ÿ”’
Allocates error handler.
alloc_kernel_heapโš 
Compatibility facade over the current global kernel heap policy.
classify_kernel_heap_backend ๐Ÿ”’
dealloc_kernel_heapโš 
Free memory previously returned by alloc_kernel_heap.
debug_register_slab_trace
Register slab lock for E9 trace (call from init).
debug_slab_lock_addr
Returns the slab lock address for deadlock tracing.
dump_diagnostics
Dump heap and buddy allocator diagnostics to the serial console.
last_heap_failure_snapshot
log_buddy_snapshot ๐Ÿ”’
log_common_oom_header ๐Ÿ”’
log_heap_failure_policy ๐Ÿ”’
record_heap_failure ๐Ÿ”’
slab_blocks_per_page
Number of blocks that fit in one buddy page for slab class ci.
slab_class_alignment
Guaranteed alignment in bytes for slab class ci.
slab_class_size
Block size in bytes for slab class ci.
slab_diag_snapshot
slab_page_in_partial_list
Returns whether the slab page at page_base is currently present in the partial-page list for class ci.
try_alloc_kernel_heapโš 
Fallible heap entry point with explicit backend-aware errors.