From e5568450c2242dc84c2686870b107a4fb751f979 Mon Sep 17 00:00:00 2001 From: Drew Galbraith Date: Wed, 15 Nov 2023 09:45:37 -0800 Subject: [PATCH] [Zion] Make kernel slab allocation failures less chatty. We started to hit this constraint but the allocators are due for a redesign that actually does deallocation soon. --- zion/memory/kernel_heap.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/zion/memory/kernel_heap.cpp b/zion/memory/kernel_heap.cpp index 508a9f5..32b17d3 100644 --- a/zion/memory/kernel_heap.cpp +++ b/zion/memory/kernel_heap.cpp @@ -43,21 +43,27 @@ void* KernelHeap::Allocate(uint64_t size) { if (ptr_or.ok()) { return ptr_or.value(); } - dbgln("Failed allocation (slab 8): {x}", ptr_or.error()); +#if K_HEAP_DEBUG + dbgln("Skipped allocation (slab 8): {x}", ptr_or.error()); +#endif } if ((size <= 16) && slab_16_) { auto ptr_or = slab_16_->Allocate(); if (ptr_or.ok()) { return ptr_or.value(); } - dbgln("Failed allocation (slab 16): {x}", ptr_or.error()); +#if K_HEAP_DEBUG + dbgln("Skipped allocation (slab 16): {x}", ptr_or.error()); +#endif } if ((size <= 32) && slab_32_) { auto ptr_or = slab_32_->Allocate(); if (ptr_or.ok()) { return ptr_or.value(); } - dbgln("Failed allocation (slab 32): {x}", ptr_or.error()); +#if K_HEAP_DEBUG + dbgln("Skipped allocation (slab 32): {x}", ptr_or.error()); +#endif } if (next_addr_ + size >= upper_bound_) { panic("Kernel Heap Overrun (next, size, max): {x}, {x}, {x}", next_addr_,