mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 21:15:08 +00:00
Kernel: Remove double-counting of allocated pages in AnonymousVMObject
When constructing an AnonymousVMObject with the AllocateNow allocation strategy we accidentally allocated the committed pages directly through MemoryManager instead of taking them from our m_unused_physical_pages CommittedPhysicalPageSet, which meant they were counted as allocated in MemoryManager, but were still counted as unallocated in the PageSet, who would then try to uncommit them on destruction, resulting in a failed assertion. To help prevent similar issues in the future a Badge<T> was added to MM::allocate_committed_user_physical_page to prevent allocation of commited pages not via a CommittedPhysicalPageSet.
This commit is contained in:
parent
e8d10fb429
commit
3e909c0c49
3 changed files with 4 additions and 4 deletions
|
@ -840,7 +840,7 @@ RefPtr<PhysicalPage> MemoryManager::find_free_user_physical_page(bool committed)
|
|||
return page;
|
||||
}
|
||||
|
||||
NonnullRefPtr<PhysicalPage> MemoryManager::allocate_committed_user_physical_page(ShouldZeroFill should_zero_fill)
|
||||
NonnullRefPtr<PhysicalPage> MemoryManager::allocate_committed_user_physical_page(Badge<CommittedPhysicalPageSet>, ShouldZeroFill should_zero_fill)
|
||||
{
|
||||
ScopedSpinLock lock(s_mm_lock);
|
||||
auto page = find_free_user_physical_page(true);
|
||||
|
@ -1134,7 +1134,7 @@ NonnullRefPtr<PhysicalPage> CommittedPhysicalPageSet::take_one()
|
|||
{
|
||||
VERIFY(m_page_count > 0);
|
||||
--m_page_count;
|
||||
return MM.allocate_committed_user_physical_page(MemoryManager::ShouldZeroFill::Yes);
|
||||
return MM.allocate_committed_user_physical_page({}, MemoryManager::ShouldZeroFill::Yes);
|
||||
}
|
||||
|
||||
void CommittedPhysicalPageSet::uncommit_one()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue