Bläddra i källkod

Kernel: Don't release file-pages if volatile memory purge did it

Jorropo 3 år sedan
förälder
incheckning
ec4b83326b
1 ändrade filer med 6 tillägg och 4 borttagningar
  1. 6 4
      Kernel/Memory/MemoryManager.cpp

+ 6 - 4
Kernel/Memory/MemoryManager.cpp

@@ -942,6 +942,8 @@ ErrorOr<NonnullRefPtr<PhysicalPage>> MemoryManager::allocate_physical_page(Shoul
             }
             }
             return IterationDecision::Continue;
             return IterationDecision::Continue;
         });
         });
+    }
+    if (!page) {
         // Second, we look for a file-backed VMObject with clean pages.
         // Second, we look for a file-backed VMObject with clean pages.
         for_each_vmobject([&](auto& vmobject) {
         for_each_vmobject([&](auto& vmobject) {
             if (!vmobject.is_inode())
             if (!vmobject.is_inode())
@@ -956,10 +958,10 @@ ErrorOr<NonnullRefPtr<PhysicalPage>> MemoryManager::allocate_physical_page(Shoul
             }
             }
             return IterationDecision::Continue;
             return IterationDecision::Continue;
         });
         });
-        if (!page) {
-            dmesgln("MM: no physical pages available");
-            return ENOMEM;
-        }
+    }
+    if (!page) {
+        dmesgln("MM: no physical pages available");
+        return ENOMEM;
     }
     }
 
 
     if (should_zero_fill == ShouldZeroFill::Yes) {
     if (should_zero_fill == ShouldZeroFill::Yes) {