serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Kernel/Memory: Various fixes for anonymous mmaps

Open brody-qq opened this issue 1 year ago • 3 comments

This PR fixes the following problems related to anonymous mmaps:

  • After a fork, writes to an anonymous mmap cause redundant page faults (#24637)
  • Writes to a shared anonymous mmap are not visible to other processes that share the mmap (#24638)
  • VMObject::try_clone() overcommits pages to m_shared_committed_cow_pages

This PR also adds more test cases for anonymous mmaps.

brody-qq avatar Jul 01 '24 01:07 brody-qq

Hello!

One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why. Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

BuggieBot avatar Jul 01 '24 01:07 BuggieBot

@spholz You know this code a bit, right? Want to look at this? :)

nico avatar Jul 01 '24 10:07 nico

Seems like one of the other kernel PRs created some conflicts

Hendiadyoin1 avatar Jul 08 '24 08:07 Hendiadyoin1

Seems like one of the other kernel PRs created some conflicts

Fixed, it was some new code in Region.cpp that didn't impact any functionality of this PR.

brody-qq avatar Jul 11 '24 14:07 brody-qq

Thanks!

Since you're in this part of the code: If you're looking for things to do, it'd be nice if posix_spawn() could become a syscall instead of being implemented in userspace. We could save the time needed to copy page metadata then. Most processes are launched using posix_spawn() in serenity, so that might help with performance.

nico avatar Jul 12 '24 12:07 nico

Thanks!

Since you're in this part of the code: If you're looking for things to do, it'd be nice if posix_spawn() could become a syscall instead of being implemented in userspace. We could save the time needed to copy page metadata then. Most processes are launched using posix_spawn() in serenity, so that might help with performance.

I appologise if commenting on a closed PR is the incorrect form to ask: but is this still something that would be interesting to do? From what I can tell it is still implemented as a library function and not a system call. Could I start work on a PR to make it a system call?

hiperbolt avatar Mar 04 '25 01:03 hiperbolt

That'd be great!

nico avatar Mar 04 '25 04:03 nico

Look ma I'm famous!!

ghost avatar Mar 04 '25 10:03 ghost