diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-01 19:58:41 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-01 19:58:41 +0200 |
commit | d481ae95b5f1267a06221af7e3b77cfa3d4872d7 (patch) | |
tree | c89e56f4596d503bc784559272c5057b6bf85136 /Kernel/VM/MemoryManager.cpp | |
parent | 9e7560fae9d7c6484594f8a6e41adfb125f809d6 (diff) | |
download | serenity-d481ae95b5f1267a06221af7e3b77cfa3d4872d7.zip |
Kernel: Defer creation of Region CoW bitmaps until they're needed
Instead of allocating and populating a Copy-on-Write bitmap for each
Region up front, wait until we actually clone the Region for sharing
with another process.
In most cases, we never need any CoW bits and we save ourselves a lot
of kmalloc() memory and time.
Diffstat (limited to 'Kernel/VM/MemoryManager.cpp')
-rw-r--r-- | Kernel/VM/MemoryManager.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index 4e6733b9b3..0e3cfcfc3d 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -307,7 +307,6 @@ bool MemoryManager::zero_page(Region& region, unsigned page_index_in_region) #ifdef PAGE_FAULT_DEBUG dbgprintf(" >> ZERO P%p\n", physical_page->paddr().get()); #endif - region.set_should_cow(page_index_in_region, false); vmo.physical_pages()[page_index_in_region] = move(physical_page); remap_region_page(region, page_index_in_region); return true; @@ -468,9 +467,9 @@ OwnPtr<Region> MemoryManager::allocate_kernel_region(size_t size, const StringVi ASSERT(range.is_valid()); OwnPtr<Region> region; if (user_accessible) - region = Region::create_user_accessible(range, name, PROT_READ | PROT_WRITE | PROT_EXEC, false); + region = Region::create_user_accessible(range, name, PROT_READ | PROT_WRITE | PROT_EXEC); else - region = Region::create_kernel_only(range, name, PROT_READ | PROT_WRITE | PROT_EXEC, false); + region = Region::create_kernel_only(range, name, PROT_READ | PROT_WRITE | PROT_EXEC); MM.map_region_at_address(*m_kernel_page_directory, *region, range.base()); // FIXME: It would be cool if these could zero-fill on demand instead. if (should_commit) |