Procházet zdrojové kódy

Kernel: Don't remap already non-writable regions when they become CoW

The only purpose of the remap() in Region::try_clone() is to ensure
non-writable page table entries for CoW regions. If a region is already
non-writable, there's no need to waste time updating the page tables.
Andreas Kling před 3 roky
rodič
revize
094b88e6a5
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      Kernel/Memory/Region.cpp

+ 2 - 1
Kernel/Memory/Region.cpp

@@ -94,7 +94,8 @@ ErrorOr<NonnullOwnPtr<Region>> Region::try_clone()
     auto vmobject_clone = TRY(vmobject().try_clone());
     auto vmobject_clone = TRY(vmobject().try_clone());
 
 
     // Set up a COW region. The parent (this) region becomes COW as well!
     // Set up a COW region. The parent (this) region becomes COW as well!
-    remap();
+    if (is_writable())
+        remap();
 
 
     OwnPtr<KString> clone_region_name;
     OwnPtr<KString> clone_region_name;
     if (m_name)
     if (m_name)