summaryrefslogtreecommitdiff
path: root/Kernel/VM/VMObject.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-14 11:51:00 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-14 11:51:00 +0200
commitc8a216b1073ef2145377160224c51a6e445bdf17 (patch)
tree2dc8e974415c85f69aadbf1aef26e253606c755b /Kernel/VM/VMObject.cpp
parent8c3ad802d892cb4a32674f74fa752c71ea250eda (diff)
downloadserenity-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/VM/VMObject.cpp')
-rw-r--r--Kernel/VM/VMObject.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Kernel/VM/VMObject.cpp b/Kernel/VM/VMObject.cpp
index 6a772776b7..a06935257a 100644
--- a/Kernel/VM/VMObject.cpp
+++ b/Kernel/VM/VMObject.cpp
@@ -80,7 +80,11 @@ void VMObject::for_each_region(Callback callback)
{
// FIXME: Figure out a better data structure so we don't have to walk every single region every time an inode changes.
// Perhaps VMObject could have a Vector<Region*> with all of his mappers?
- for (auto* region : MM.m_regions) {
+ for (auto* region : MM.m_user_regions) {
+ if (&region->vmo() == this)
+ callback(*region);
+ }
+ for (auto* region : MM.m_kernel_regions) {
if (&region->vmo() == this)
callback(*region);
}