From 073c90e9485b6f9c2a088d201adb1f65ebff7dc1 Mon Sep 17 00:00:00 2001 From: apio Date: Thu, 20 Oct 2022 18:49:00 +0200 Subject: [PATCH] InitRD: leak an unused pointer so kmalloc() doesn't map memory all the time --- kernel/src/init/InitRD.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/src/init/InitRD.cpp b/kernel/src/init/InitRD.cpp index 9863b31b..01f9432d 100644 --- a/kernel/src/init/InitRD.cpp +++ b/kernel/src/init/InitRD.cpp @@ -375,8 +375,10 @@ void InitRD::init() (void*)bootboot.initrd_ptr, Utilities::get_blocks_from_size(PAGE_SIZE, bootboot.initrd_size)); kdbgln("physical base at %lx, size %lx, mapped to %p", bootboot.initrd_ptr, bootboot.initrd_size, initrd_base); kdbgln("total blocks: %ld", get_total_blocks()); + void* leak = kmalloc(4); // leak some memory so that kmalloc doesn't continually allocate and free pages initrd_initialize_root(); initrd_scan(); VFS::mount_root(&initrd_root); initrd_initialized = true; + kfree(leak); } \ No newline at end of file