diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-05-14 11:51:00 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-14 11:51:00 +0200 |
commit | c8a216b1073ef2145377160224c51a6e445bdf17 (patch) | |
tree | 2dc8e974415c85f69aadbf1aef26e253606c755b /Kernel/Thread.h | |
parent | 8c3ad802d892cb4a32674f74fa752c71ea250eda (diff) | |
download | serenity-c8a216b1073ef2145377160224c51a6e445bdf17.zip |
Kernel: Allocate kernel stacks for threads using the region allocator.
This patch moves away from using kmalloc memory for thread kernel stacks.
This reduces pressure on kmalloc (16 KB per thread adds up fast) and
prevents kernel stack overflow from scribbling all over random unrelated
kernel memory.
Diffstat (limited to 'Kernel/Thread.h')
-rw-r--r-- | Kernel/Thread.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/Thread.h b/Kernel/Thread.h index ad82e5e9bc..49d5274cd0 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -4,6 +4,7 @@ #include <Kernel/KResult.h> #include <Kernel/LinearAddress.h> #include <Kernel/UnixTypes.h> +#include <Kernel/VM/Region.h> #include <AK/AKString.h> #include <AK/InlineLinkedList.h> #include <AK/OwnPtr.h> @@ -100,7 +101,7 @@ public: void set_ticks_left(dword t) { m_ticks_left = t; } dword ticks_left() const { return m_ticks_left; } - dword kernel_stack_base() const { return (dword)m_kernel_stack; } + dword kernel_stack_base() const { return m_kernel_stack_region->laddr().get(); } dword kernel_stack_for_signal_handler_base() const { return (dword)m_kernel_stack_for_signal_handler; } void set_selector(word s) { m_far_ptr.selector = s; } @@ -144,7 +145,7 @@ private: dword m_times_scheduled { 0 }; dword m_pending_signals { 0 }; dword m_signal_mask { 0 }; - void* m_kernel_stack { nullptr }; + RetainPtr<Region> m_kernel_stack_region; void* m_kernel_stack_for_signal_handler { nullptr }; pid_t m_waitee_pid { -1 }; RetainPtr<FileDescriptor> m_blocked_descriptor; |