diff --git a/zion/memory/kernel_heap.cpp b/zion/memory/kernel_heap.cpp index 3564f68..e82eb62 100644 --- a/zion/memory/kernel_heap.cpp +++ b/zion/memory/kernel_heap.cpp @@ -60,6 +60,24 @@ void* KernelHeap::Allocate(uint64_t size) { } #if K_HEAP_DEBUG dbgln("Skipped allocation (slab 32): {x}", ptr_or.error()); +#endif + } + if (size <= 64) { + auto ptr_or = slab_64_.Allocate(); + if (ptr_or.ok()) { + return ptr_or.value(); + } +#if K_HEAP_DEBUG + dbgln("Skipped allocation (slab 64): {x}", ptr_or.error()); +#endif + } + if (size <= 128) { + auto ptr_or = slab_128_.Allocate(); + if (ptr_or.ok()) { + return ptr_or.value(); + } +#if K_HEAP_DEBUG + dbgln("Skipped allocation (slab 128): {x}", ptr_or.error()); #endif } if (next_addr_ + size >= upper_bound_) { @@ -98,6 +116,10 @@ void KernelHeap::DumpDebugDataInternal() { slab_16_.Allocations()); dbgln("Slab 32: {} slabs, {} allocs", slab_32_.SlabCount(), slab_32_.Allocations()); + dbgln("Slab 64: {} slabs, {} allocs", slab_64_.SlabCount(), + slab_64_.Allocations()); + dbgln("Slab 128: {} slabs, {} allocs", slab_128_.SlabCount(), + slab_128_.Allocations()); dbgln(""); dbgln("Size Distributions of non slab-allocated."); diff --git a/zion/memory/kernel_heap.h b/zion/memory/kernel_heap.h index 3171ef6..22c20ce 100644 --- a/zion/memory/kernel_heap.h +++ b/zion/memory/kernel_heap.h @@ -26,6 +26,8 @@ class KernelHeap { SlabAllocator slab_8_{8}; SlabAllocator slab_16_{16}; SlabAllocator slab_32_{32}; + SlabAllocator slab_64_{64}; + SlabAllocator slab_128_{128}; // Distribution collection for the purpose of investigating a slab allocator. // 0: 0-8B