mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
24ecf1d021
The purpose of the PageDirectory::m_page_tables map was really just to act as ref-counting storage for PhysicalPage objects that were being used for the directory's page tables. However, this was basically redundant, since we can find the physical address of each page table from the page directory, and we can find the PhysicalPage object from MemoryManager::get_physical_page_entry(). So if we just manually ref() and unref() the pages when they go in and out of the directory, we no longer need PageDirectory::m_page_tables! Not only does this remove a bunch of kmalloc() traffic, it also solves a race condition that would occur when lazily adding a new page table to a directory: Previously, when MemoryManager::ensure_pte() would call HashMap::set() to insert the new page table into m_page_tables, if the HashMap had to grow its internal storage, it would call kmalloc(). If that kmalloc() would need to perform heap expansion, it would end up calling ensure_pte() again, which would clobber the page directory mapping used by the outer invocation of ensure_pte(). The net result of the above bug would be that any invocation of MemoryManager::ensure_pte() could erroneously return a pointer into a kernel page table instead of the correct one! This whole problem goes away when we remove the HashMap, as ensure_pte() no longer does anything that allocates from the heap. |
||
---|---|---|
.. | ||
AddressSpace.cpp | ||
AddressSpace.h | ||
AllocationStrategy.h | ||
AnonymousVMObject.cpp | ||
AnonymousVMObject.h | ||
InodeVMObject.cpp | ||
InodeVMObject.h | ||
MappedROM.h | ||
MemoryManager.cpp | ||
MemoryManager.h | ||
PageDirectory.cpp | ||
PageDirectory.h | ||
PageFaultResponse.h | ||
PhysicalPage.cpp | ||
PhysicalPage.h | ||
PhysicalRegion.cpp | ||
PhysicalRegion.h | ||
PhysicalZone.cpp | ||
PhysicalZone.h | ||
PrivateInodeVMObject.cpp | ||
PrivateInodeVMObject.h | ||
Region.cpp | ||
Region.h | ||
RingBuffer.cpp | ||
RingBuffer.h | ||
ScatterGatherList.cpp | ||
ScatterGatherList.h | ||
ScopedAddressSpaceSwitcher.cpp | ||
ScopedAddressSpaceSwitcher.h | ||
SharedInodeVMObject.cpp | ||
SharedInodeVMObject.h | ||
TypedMapping.h | ||
VirtualRange.cpp | ||
VirtualRange.h | ||
VirtualRangeAllocator.cpp | ||
VirtualRangeAllocator.h | ||
VMObject.cpp | ||
VMObject.h |