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.
This commit is contained in:
Andreas Kling 2022-01-15 17:48:42 +01:00
parent c6adefcfc0
commit 094b88e6a5
Notes: sideshowbarker 2024-07-17 20:51:25 +09:00

View File

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