mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +00:00
Kernel: Release 1 page instead of all pages when starved for pages
Previously, when starved for pages, *all* clean file-backed memory would be released, which is quite excessive. This patch instead releases just 1 page, since only 1 page is needed to satisfy the request to `allocate_physical_page()`
This commit is contained in:
parent
09d0fae2c6
commit
8180211431
1 changed files with 1 additions and 2 deletions
|
@ -949,8 +949,7 @@ ErrorOr<NonnullRefPtr<PhysicalPage>> MemoryManager::allocate_physical_page(Shoul
|
|||
if (!vmobject.is_inode())
|
||||
return IterationDecision::Continue;
|
||||
auto& inode_vmobject = static_cast<InodeVMObject&>(vmobject);
|
||||
// FIXME: It seems excessive to release *all* clean pages from the inode when we only need one.
|
||||
if (auto released_page_count = inode_vmobject.release_all_clean_pages()) {
|
||||
if (auto released_page_count = inode_vmobject.try_release_clean_pages(1)) {
|
||||
dbgln("MM: Clean inode release saved the day! Released {} pages from InodeVMObject", released_page_count);
|
||||
page = find_free_physical_page(false);
|
||||
VERIFY(page);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue