-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Approaches for avoiding fragmentation in code memory allocation #14626
Comments
Ok, after a lengthy conversation between @yuyichao and myself we've come up with the following plan to address this: As a generic fallback for Unix, use a MAP_SHARED mmap region to create two mappings to the memory region, the first of which has the appropriate permissions, the second is mapped either PROT_NONE or PROT_WRITE depending on whether we currently need to access it or not. Once we no longer need a page in the second mapping, we can also unmap it. There are also several operating-system specific parts to take into account:
@yuyichao Please add anything I may have forgotten. |
For fork support, I guess throwing away the pages in the parent is potentially bad since it can happen fairly often. The fork concern also applies to many other implementations as well ( |
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626 [av skip]
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626 [av skip]
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626 [av skip]
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626 [av skip]
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626 [av skip]
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
Use various ways to reuse the page that has the page protection set in order to avoid wasting a page of memory for each JIT event. Fixes #14626
This is moved over from #14623. Currently LLVM's memory allocator will not write to memory that has been protected already, causing some amount of memory fragmentation. It would be good to figure out how to avoid this, while maintaining W^X memory protection guarantees.
The text was updated successfully, but these errors were encountered: