From 38c8dc22cf258df2230bab64984023cd8e9c59b2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 4 Mar 2021 11:13:17 +0100 Subject: [PATCH] Kernel: Remove unused KMALLOC_DEBUG_LARGE_ALLOCATIONS mode This was a thing back when the system was so little that any kernel allocation above 1 MiB was basically guaranteed to be a bug. :^) --- Kernel/Debug.h.in | 8 -------- Kernel/Heap/kmalloc.cpp | 2 +- Kernel/Heap/kmalloc.h | 10 +--------- Meta/CMake/all_the_debug_macros.cmake | 1 - 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/Kernel/Debug.h.in b/Kernel/Debug.h.in index ca6000b9075..38008f40961 100644 --- a/Kernel/Debug.h.in +++ b/Kernel/Debug.h.in @@ -150,10 +150,6 @@ #cmakedefine01 KEYBOARD_DEBUG #endif -#ifndef KMALLOC_DEBUG -#cmakedefine01 KMALLOC_DEBUG -#endif - #ifndef LOCAL_SOCKET_DEBUG #cmakedefine01 LOCAL_SOCKET_DEBUG #endif @@ -317,7 +313,3 @@ #ifndef WAITQUEUE_DEBUG #cmakedefine01 WAITQUEUE_DEBUG #endif - -#ifndef KMALLOC_DEBUG_LARGE_ALLOCATIONS -#cmakedefine01 KMALLOC_DEBUG_LARGE_ALLOCATIONS -#endif diff --git a/Kernel/Heap/kmalloc.cpp b/Kernel/Heap/kmalloc.cpp index b66e2767328..0dc4fd1f215 100644 --- a/Kernel/Heap/kmalloc.cpp +++ b/Kernel/Heap/kmalloc.cpp @@ -236,7 +236,7 @@ void* kmalloc_eternal(size_t size) return ptr; } -void* kmalloc_impl(size_t size) +void* kmalloc(size_t size) { ScopedSpinLock lock(s_lock); ++g_kmalloc_call_count; diff --git a/Kernel/Heap/kmalloc.h b/Kernel/Heap/kmalloc.h index adeb38559c5..b71b0277164 100644 --- a/Kernel/Heap/kmalloc.h +++ b/Kernel/Heap/kmalloc.h @@ -53,15 +53,7 @@ extern bool g_dump_kmalloc_stacks; inline void* operator new(size_t, void* p) { return p; } inline void* operator new[](size_t, void* p) { return p; } -[[gnu::malloc, gnu::returns_nonnull, gnu::alloc_size(1)]] ALWAYS_INLINE void* kmalloc(size_t size) -{ -#if KMALLOC_DEBUG_LARGE_ALLOCATIONS - // Any kernel allocation >= 1M is 99.9% a bug. - if (size >= 1048576) - asm volatile("cli;hlt"); -#endif - return kmalloc_impl(size); -} +[[gnu::malloc, gnu::returns_nonnull, gnu::alloc_size(1)]] void* kmalloc(size_t); template [[gnu::malloc, gnu::returns_nonnull, gnu::alloc_size(1)]] inline void* kmalloc_aligned(size_t size) diff --git a/Meta/CMake/all_the_debug_macros.cmake b/Meta/CMake/all_the_debug_macros.cmake index 8326a0f7cb0..05e975802a0 100644 --- a/Meta/CMake/all_the_debug_macros.cmake +++ b/Meta/CMake/all_the_debug_macros.cmake @@ -134,7 +134,6 @@ set(ICO_DEBUG ON) set(IPV4_DEBUG ON) set(IRC_DEBUG ON) set(KEYBOARD_DEBUG ON) -set(KMALLOC_DEBUG_LARGE_ALLOCATIONS ON) set(LEXER_DEBUG ON) set(LOOKUPSERVER_DEBUG ON) set(MALLOC_DEBUG ON)