summaryrefslogtreecommitdiff
path: root/Kernel/Memory
diff options
context:
space:
mode:
authordylanbobb <dylan.bobb@hotmail.com>2022-08-14 23:08:22 -0400
committerAndreas Kling <kling@serenityos.org>2022-08-16 01:13:17 +0200
commit8180211431c6541a2aa5f2f076254e762cb3316f (patch)
tree251564f237fbaadd4cd175dcae54785b6147d171 /Kernel/Memory
parent09d0fae2c6d267cce4d4a757988f5c889aa70531 (diff)
downloadserenity-8180211431c6541a2aa5f2f076254e762cb3316f.zip
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()`
Diffstat (limited to 'Kernel/Memory')
-rw-r--r--Kernel/Memory/MemoryManager.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp
index ff45405fce..881422cf52 100644
--- a/Kernel/Memory/MemoryManager.cpp
+++ b/Kernel/Memory/MemoryManager.cpp
@@ -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);