1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

Kernel: Ignore TLB flush requests for user addresses of other processes

If a TLB flush request is broadcast to other processors and the addresses
to flush are user mode addresses, we can ignore such a request on the
target processor if the page directory currently in use doesn't match
the addresses to be flushed. We still need to broadcast to all processors
in that case because the other processors may switch to that same page
directory at any time.
This commit is contained in:
Tom 2021-01-02 12:27:38 -07:00 committed by Andreas Kling
parent c630669304
commit 0d44ee6f2b
Notes: sideshowbarker 2024-07-19 00:11:41 +09:00
5 changed files with 25 additions and 12 deletions

View file

@ -320,7 +320,7 @@ bool Region::do_remap_vmobject_page_range(size_t page_index, size_t page_count)
index++;
}
if (index > page_index)
MM.flush_tlb(vaddr_from_page_index(page_index), index - page_index);
MM.flush_tlb(m_page_directory, vaddr_from_page_index(page_index), index - page_index);
return success;
}
@ -351,7 +351,7 @@ bool Region::do_remap_vmobject_page(size_t page_index, bool with_flush)
ASSERT(physical_page(page_index));
bool success = map_individual_page_impl(page_index);
if (with_flush)
MM.flush_tlb(vaddr_from_page_index(page_index));
MM.flush_tlb(m_page_directory, vaddr_from_page_index(page_index));
return success;
}
@ -387,7 +387,7 @@ void Region::unmap(ShouldDeallocateVirtualMemoryRange deallocate_range)
dbg() << "MM: >> Unmapped " << vaddr << " => P" << String::format("%p", page ? page->paddr().get() : 0) << " <<";
#endif
}
MM.flush_tlb(vaddr(), page_count());
MM.flush_tlb(m_page_directory, vaddr(), page_count());
if (deallocate_range == ShouldDeallocateVirtualMemoryRange::Yes) {
if (m_page_directory->range_allocator().contains(range()))
m_page_directory->range_allocator().deallocate(range());
@ -419,7 +419,7 @@ bool Region::map(PageDirectory& page_directory)
++page_index;
}
if (page_index > 0) {
MM.flush_tlb(vaddr(), page_index);
MM.flush_tlb(m_page_directory, vaddr(), page_index);
return page_index == page_count();
}
return false;