This repository was archived by the owner on Mar 24, 2022. It is now read-only.
Allow flexible memory management using Uffd#515
Closed
tyler wants to merge 28 commits intotyler/uffd-integrationfrom
Closed
Allow flexible memory management using Uffd#515tyler wants to merge 28 commits intotyler/uffd-integrationfrom
tyler wants to merge 28 commits intotyler/uffd-integrationfrom
Conversation
…rting with entrypoint_test.
… a fork-related bug.
- Instantiates the suite in `lucet_runtime_internals::alloc::tests` for `UffdRegion - Fixes early return issues in `UffdRegion` similar to #455 - Adds a test to show that the per-instance heap limit applies to runtime expansions, not just initial instantiation - Refactors `validate_runtime_spec` to take the per-instance heap limit as an additional argument. This centralizes the logic for rejecting initially-oversized heap limits, and makes it clearer what's happening in each region's instantiation logic. - Removes the `UffdRegion`'s assertion that signal stack size is a multiple of page size. Since the user can now control this as a parameter, we reject it gracefully when validating `Limits` rather than panicking.
Leaving the question of errors in the handler alone for this commit, since that'll be a more major change.
Notably, this should get us building and running uffd in Linux CI. It turns out to be a tremendous pain to enable a feature flag for just one crate within a workspace. The situation is [being addressed][1], but in the meantime I believe the best route forward is to just have uffd on by default for Linux. [1]: rust-lang/cargo#5364
acfoltzer
approved these changes
May 11, 2020
Contributor
acfoltzer
left a comment
There was a problem hiding this comment.
Just a little style note, otherwise I think this looks fantastic. I'm really pleased how easily you were able to extract those bits! I guess when you're dealing with raw pointers, you don't have to worry at all about cloning or borrowing snags 🙂
Co-authored-by: Adam C. Foltzer <acfoltzer@fastly.com>
…d of a host page.
…ization works as expected.
fc3049a to
a96cb55
Compare
Member
Author
|
Cherry picked the relevant bits over to #492 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a UffdStrategy trait to allow users of UffdRegion to configure the way faults are handled.
This will be important especially to Lucet users who have highly concurrent applications and potentially large linear memories. Uffd in its most naive form is likely to be slower than the Mmap region because of the additional work done to shunt faults back into userspace, and the reaction to those faults over to the kernel.
This can be dealt with by being smarter about how those faults are handled. For instance, work can be batched up. Instead of copying one host page per fault, one could copy a batch of them. This doesn't implement that, but does provide the facilities to make it possible.