mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: Stop committing pages for COW of uncommitted pages on sys$fork
Uncommitted pages (shared zero pages) can not contain any existing data and can not be modified, so there's no point to committing a bunch of extra pages to cover for them in the forked child.
This commit is contained in:
parent
38696dc626
commit
8717e78918
Notes:
sideshowbarker
2024-07-18 02:13:10 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/8717e78918 Pull-request: https://github.com/SerenityOS/serenity/pull/14547
1 changed files with 8 additions and 1 deletions
|
@ -31,7 +31,14 @@ ErrorOr<NonnullRefPtr<VMObject>> AnonymousVMObject::try_clone()
|
|||
// commit the number of pages that we need to potentially allocate
|
||||
// so that the parent is still guaranteed to be able to have all
|
||||
// non-volatile memory available.
|
||||
size_t new_cow_pages_needed = page_count();
|
||||
size_t new_cow_pages_needed = 0;
|
||||
for (auto const& page : m_physical_pages) {
|
||||
if (!page->is_shared_zero_page())
|
||||
++new_cow_pages_needed;
|
||||
}
|
||||
|
||||
if (new_cow_pages_needed == 0)
|
||||
return TRY(try_create_with_size(size(), AllocationStrategy::None));
|
||||
|
||||
dbgln_if(COMMIT_DEBUG, "Cloning {:p}, need {} committed cow pages", this, new_cow_pages_needed);
|
||||
|
||||
|
|
Loading…
Reference in a new issue