Skip to content

Use mremap on Linux instead of munmap+mmap#221

Merged
ajeetdsouza merged 3 commits intomasterfrom
ajeet/mremap
Nov 10, 2020
Merged

Use mremap on Linux instead of munmap+mmap#221
ajeetdsouza merged 3 commits intomasterfrom
ajeet/mremap

Conversation

@ajeetdsouza
Copy link
Contributor

@ajeetdsouza ajeetdsouza commented Nov 10, 2020

Linux exposes an mremap function that is not available on other OSes, that allows us to remap an address space, providing a more efficient way to increase the size of an mmap file. This PR allows Linux systems to use the mremap call, while other OSes continue to use munmap followed by mmap.

sys does not provide an mremap function, so this had to handwritten using a system call. Unfortunately, the functions provided by sys for Mmap/Munmap maintain a list of active mappings, and do not allow us to Munmap anything that is not present in the list. Since our handwritten mremap call cannot update that internal list, we must reimplement the munmap system call as well.


This change is Reviewable

Copy link
Contributor

@jarifibrahim jarifibrahim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean it up and it's good to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants