Kernel: If someone else zero-fills a shared VMO page, don't freak out.

Just map the new page and move on.
This commit is contained in:
Andreas Kling 2019-02-20 21:33:07 +01:00
parent 6158f456fa
commit 266e77259e
Notes: sideshowbarker 2024-07-19 15:39:36 +09:00

View file

@ -233,6 +233,17 @@ bool MemoryManager::zero_page(Region& region, unsigned page_index_in_region)
{
ASSERT_INTERRUPTS_DISABLED();
auto& vmo = region.vmo();
auto& vmo_page = vmo.physical_pages()[region.first_page_index() + page_index_in_region];
sti();
LOCKER(vmo.m_paging_lock);
cli();
if (!vmo_page.is_null()) {
#ifdef PAGE_FAULT_DEBUG
dbgprintf("MM: zero_page() but page already present. Fine with me!\n");
#endif
remap_region_page(region, page_index_in_region, true);
return true;
}
auto physical_page = allocate_physical_page(ShouldZeroFill::Yes);
#ifdef PAGE_FAULT_DEBUG
dbgprintf(" >> ZERO P%x\n", physical_page->paddr().get());