1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

Kernel: CoW-clone private inode-backed memory regions on fork()

When forking a process, we now turn all of the private inode-backed
mmap() regions into copy-on-write regions in both the parent and child.

This patch also removes an assertion that becomes irrelevant.
This commit is contained in:
Andreas Kling 2020-03-01 10:54:18 +01:00
parent 88e12f7632
commit fddc3c957b

View file

@ -76,8 +76,7 @@ NonnullOwnPtr<Region> Region::clone()
{
ASSERT(Process::current);
// FIXME: What should we do for privately mapped SharedInodeVMObjects?
if (m_shared || vmobject().is_inode()) {
if (m_shared) {
ASSERT(!m_stack);
#ifdef MM_DEBUG
dbg() << "Region::clone(): Sharing " << name() << " (" << vaddr() << ")";
@ -100,7 +99,6 @@ NonnullOwnPtr<Region> Region::clone()
if (m_stack) {
ASSERT(is_readable());
ASSERT(is_writable());
ASSERT(!is_shared());
ASSERT(vmobject().is_anonymous());
clone_region->set_stack(true);
}