1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 09:27:35 +00:00

Kernel: Skip TLB flushes while cloning regions in sys$fork()

Since we know for sure that the virtual memory regions in the new
process being created are not being used on any CPU, there's no need
to do TLB flushes for every mapped page.
This commit is contained in:
Andreas Kling 2021-03-03 22:45:18 +01:00
parent 8fd69e9e56
commit a819eb5016
3 changed files with 10 additions and 4 deletions

View file

@ -385,7 +385,7 @@ void Region::set_page_directory(PageDirectory& page_directory)
m_page_directory = page_directory;
}
bool Region::map(PageDirectory& page_directory)
bool Region::map(PageDirectory& page_directory, ShouldFlushTLB should_flush_tlb)
{
ScopedSpinLock lock(s_mm_lock);
ScopedSpinLock page_lock(page_directory.get_lock());
@ -403,7 +403,8 @@ bool Region::map(PageDirectory& page_directory)
++page_index;
}
if (page_index > 0) {
MM.flush_tlb(m_page_directory, vaddr(), page_index);
if (should_flush_tlb == ShouldFlushTLB::Yes)
MM.flush_tlb(m_page_directory, vaddr(), page_index);
return page_index == page_count();
}
return false;