Kernel: Memory purging was incorrectly "purging" the shared zero page

This caused us to report one purged page per occurrence of the shared
zero page in a purgeable memory region, despite it being a no-op.

Thanks to Sergey for spotting the bad assertion removal that led to
this being found!
This commit is contained in:
Andreas Kling 2020-05-07 09:41:50 +02:00
parent 6fe83b0ac4
commit beaec6bd2d
Notes: sideshowbarker 2024-07-19 06:55:23 +09:00
2 changed files with 2 additions and 1 deletions

View file

@ -448,6 +448,7 @@ RefPtr<PhysicalPage> MemoryManager::allocate_user_physical_page(ShouldZeroFill s
if (purged_page_count) {
klog() << "MM: Purge saved the day! Purged " << purged_page_count << " pages from PurgeableVMObject{" << &purgeable_vmobject << "}";
page = find_free_user_physical_page();
ASSERT(page);
return IterationDecision::Break;
}
}

View file

@ -74,7 +74,7 @@ int PurgeableVMObject::purge_impl()
return 0;
int purged_page_count = 0;
for (size_t i = 0; i < m_physical_pages.size(); ++i) {
if (m_physical_pages[i])
if (m_physical_pages[i] && !m_physical_pages[i]->is_shared_zero_page())
++purged_page_count;
m_physical_pages[i] = MM.shared_zero_page();
}