mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +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
Notes:
sideshowbarker
2024-07-17 22:01:16 +09:00
Author: https://github.com/dylanbobb Commit: https://github.com/SerenityOS/serenity/commit/8180211431 Pull-request: https://github.com/SerenityOS/serenity/pull/14867 Reviewed-by: https://github.com/AtkinsSJ Reviewed-by: https://github.com/circl-lastname
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…
Reference in a new issue