From 4f4af24b9d489634a66d818260a7f87964faf421 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 17 Feb 2020 14:33:06 +0100 Subject: [PATCH] Kernel: Tear down process address space during finalization Process teardown is divided into two main stages: finalize and reap. Finalization happens in the "Finalizer" kernel and runs with interrupts enabled, allowing destructors to take locks, etc. Reaping happens either in sys$waitid() or in the scheduler for orphans. The more work we can do in finalization, the better, since it's fully pre-emptible and reduces the amount of time the system runs without interrupts enabled. --- Kernel/Process.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index f7974a72fa..6b00ddf4d5 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -3016,6 +3016,8 @@ void Process::finalize() } } + m_regions.clear(); + m_dead = true; }