mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:05:06 +00:00
Kernel: Uncommit a shared COW page when discovering it was unshared
When we hit a COW fault and discover than no other process is sharing
the physical page, we simply remap it r/w and save ourselves the
trouble. When this happens, we can also give back (uncommit) one of our
shared committed COW pages, since we won't be needing it.
We had this optimization before, but I mistakenly removed it in
50472fd69f
since I had misunderstood
it to be the reason for a panic.
This commit is contained in:
parent
843d0d0d15
commit
dd58d0f650
4 changed files with 23 additions and 1 deletions
|
@ -1137,4 +1137,11 @@ NonnullRefPtr<PhysicalPage> CommittedPhysicalPageSet::take_one()
|
|||
return MM.allocate_committed_user_physical_page(MemoryManager::ShouldZeroFill::Yes);
|
||||
}
|
||||
|
||||
void CommittedPhysicalPageSet::uncommit_one()
|
||||
{
|
||||
VERIFY(m_page_count > 0);
|
||||
--m_page_count;
|
||||
MM.uncommit_user_physical_pages({}, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue