summaryrefslogtreecommitdiff
path: root/Kernel/Memory/AddressSpace.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-01-12 13:48:43 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-12 14:52:47 +0100
commit2323cdd91419ba2bad419f62acdbbca259f6bd45 (patch)
tree5bd1311415fa6feefd1524c4215d4f79f8baf016 /Kernel/Memory/AddressSpace.cpp
parenta702b6ec428ce8c899c2b2cdea979012ee435c9c (diff)
downloadserenity-2323cdd91419ba2bad419f62acdbbca259f6bd45.zip
Kernel: Do less unnecessary work when tearing down process address space
When deleting an entire AddressSpace, we don't need to do TLB flushes at all (since the entire page directory is going away anyway). We also don't need to deallocate VM ranges one by one, since the entire VM range allocator will be deleted anyway.
Diffstat (limited to 'Kernel/Memory/AddressSpace.cpp')
-rw-r--r--Kernel/Memory/AddressSpace.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/Memory/AddressSpace.cpp b/Kernel/Memory/AddressSpace.cpp
index d275561b4e..dbda1324e1 100644
--- a/Kernel/Memory/AddressSpace.cpp
+++ b/Kernel/Memory/AddressSpace.cpp
@@ -320,7 +320,10 @@ void AddressSpace::dump_regions()
void AddressSpace::remove_all_regions(Badge<Process>)
{
+ VERIFY(Thread::current() == g_finalizer);
SpinlockLocker lock(m_lock);
+ for (auto& region : m_regions)
+ (*region).unmap(Region::ShouldDeallocateVirtualRange::No, ShouldFlushTLB::No);
m_regions.clear();
}