From 804cbeb1a7ecf9c24b40e0357da7e0ba548d9192 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 14 Aug 2025 21:21:31 +0300 Subject: [PATCH] Kernel: Increment kmalloc storage size to 64 MiB I really don't want to do this, but rewriting kmalloc to be dynamic would require me to rewrite 32 bit paging and I really don't want to. --- kernel/kernel/Memory/kmalloc.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/kernel/Memory/kmalloc.cpp b/kernel/kernel/Memory/kmalloc.cpp index edecf362..092185b5 100644 --- a/kernel/kernel/Memory/kmalloc.cpp +++ b/kernel/kernel/Memory/kmalloc.cpp @@ -9,7 +9,9 @@ extern uint8_t g_kernel_end[]; static constexpr size_t s_kmalloc_min_align = alignof(max_align_t); -static uint8_t s_kmalloc_storage[20 * MB]; +static constexpr size_t s_kmalloc_size = 48 * MB; +static constexpr size_t s_kmalloc_fixed_size = 16 * MB; +static uint8_t s_kmalloc_storage[s_kmalloc_size + s_kmalloc_fixed_size]; struct kmalloc_node { @@ -62,7 +64,7 @@ static_assert(sizeof(kmalloc_node) == s_kmalloc_min_align); struct kmalloc_info { const uintptr_t base = (uintptr_t)s_kmalloc_storage; - const size_t size = sizeof(s_kmalloc_storage) / 2; + const size_t size = s_kmalloc_size; const uintptr_t end = base + size; kmalloc_node* first() { return (kmalloc_node*)base; } @@ -100,7 +102,7 @@ struct kmalloc_fixed_info using node = kmalloc_fixed_node<64>; const uintptr_t base = s_kmalloc_info.end; - const size_t size = (uintptr_t)s_kmalloc_storage + sizeof(s_kmalloc_storage) - base; + const size_t size = s_kmalloc_fixed_size; const uintptr_t end = base + size; const size_t node_count = size / sizeof(node);