Ver código fonte

Kernel: Release page directory and MM locks sooner in space finalization

We don't need to hold these locks when tearing down the region tree.
Release them as soon as unmapping is finished.
Andreas Kling 3 anos atrás
pai
commit
a44316fa8b
1 arquivos alterados com 6 adições e 4 exclusões
  1. 6 4
      Kernel/Memory/AddressSpace.cpp

+ 6 - 4
Kernel/Memory/AddressSpace.cpp

@@ -321,10 +321,12 @@ void AddressSpace::remove_all_regions(Badge<Process>)
 {
     VERIFY(Thread::current() == g_finalizer);
     SpinlockLocker locker(m_lock);
-    SpinlockLocker pd_locker(m_page_directory->get_lock());
-    SpinlockLocker mm_locker(s_mm_lock);
-    for (auto& region : m_regions)
-        (*region).unmap_with_locks_held(Region::ShouldDeallocateVirtualRange::No, ShouldFlushTLB::No, pd_locker, mm_locker);
+    {
+        SpinlockLocker pd_locker(m_page_directory->get_lock());
+        SpinlockLocker mm_locker(s_mm_lock);
+        for (auto& region : m_regions)
+            (*region).unmap_with_locks_held(Region::ShouldDeallocateVirtualRange::No, ShouldFlushTLB::No, pd_locker, mm_locker);
+    }
     m_regions.clear();
 }