summaryrefslogtreecommitdiff
path: root/Kernel/init.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-09-16 10:19:44 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-09-16 10:33:27 +0200
commit5d491fa1cdad08424449e129ba30baf76e7da6d1 (patch)
tree0b1ba86ca206f414f9bf9e0c759294dadc9d2458 /Kernel/init.cpp
parent1c692e87a647b26dc21825707b41b740a465a570 (diff)
downloadserenity-5d491fa1cdad08424449e129ba30baf76e7da6d1.zip
Kernel: Add a simple slab allocator for small allocations
This is a freelist allocator with static size classes that works as a complement to the generic kmalloc(). It's a lot faster than kmalloc() since allocation just means popping from the freelist. It's also significantly more compact when there are a lot of objects smaller than the minimum kmalloc chunk size (32 bytes.) This patch enables it for the Region and PhysicalPage classes. In the PhysicalPage (8 bytes) case, it's a huge improvement since we no longer waste 75% of the storage allocated. There are also a number of ways this can be improved, so let's keep working on it going forward.
Diffstat (limited to 'Kernel/init.cpp')
-rw-r--r--Kernel/init.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/init.cpp b/Kernel/init.cpp
index f6a1da6c90..d73b1bca1d 100644
--- a/Kernel/init.cpp
+++ b/Kernel/init.cpp
@@ -29,6 +29,7 @@
#include <Kernel/FileSystem/ProcFS.h>
#include <Kernel/FileSystem/TmpFS.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
+#include <Kernel/Heap/SlabAllocator.h>
#include <Kernel/Heap/kmalloc.h>
#include <Kernel/KParams.h>
#include <Kernel/Multiboot.h>
@@ -187,6 +188,7 @@ extern "C" [[noreturn]] void init()
sse_init();
kmalloc_init();
+ slab_alloc_init();
init_ksyms();
// must come after kmalloc_init because we use AK_MAKE_ETERNAL in KParams