mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
Kernel: Don't release/relock spinlocks repeatedly during space teardown
Grab the page directory and MM locks once at the start of address space teardown, then hold onto them across all the region unmapping work.
This commit is contained in:
parent
2323cdd914
commit
d8206c1059
3 changed files with 15 additions and 5 deletions
|
@ -321,9 +321,11 @@ void AddressSpace::dump_regions()
|
|||
void AddressSpace::remove_all_regions(Badge<Process>)
|
||||
{
|
||||
VERIFY(Thread::current() == g_finalizer);
|
||||
SpinlockLocker lock(m_lock);
|
||||
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(Region::ShouldDeallocateVirtualRange::No, ShouldFlushTLB::No);
|
||||
(*region).unmap_with_locks_held(Region::ShouldDeallocateVirtualRange::No, ShouldFlushTLB::No, pd_locker, mm_locker);
|
||||
m_regions.clear();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue