-
Notifications
You must be signed in to change notification settings - Fork 78
Annotate mmap ranges using PR_SET_VMA #1236
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d17ca0c
Annotate mmap ranges using PR_SET_VMA
wks a453e32
Guard the annotation behind an option.
wks 2972474
Make annotation linux-only
wks a418700
Update comments
wks 94cd260
Fix helpers_32
wks 3dfad91
Fix vmspace
wks 12ce6ae
Fix space names
wks 851444c
Fix error handling
wks b196709
Update comment
wks de848c4
Rename MmapAnno to MmapAnnotation
wks 4a5e256
Fix mock tests.
wks 5344a0b
Fix documentation
wks 491a196
Workaround sysinfo build on MacOS
wks ff31481
Revert "Workaround sysinfo build on MacOS"
wks 4089d83
Use Space::get_name consistently
wks bbfdec0
Include android, too.
wks 9d860d3
Use Relaxed order
wks 18f3f63
Update the doc for map_metadata_internal
wks c5bc4f9
Comment the "all" metadata name.
wks e1071af
Doc for strategy and anno
wks 13c10b5
Control annotation with Cargo feature instead.
wks df35f42
A missing doc comment
wks b1e43d5
API migration guide
wks b3d8672
Remove unused static variable
wks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,7 @@ fn is_meta_space_mapped_for_address(address: Address) -> bool { | |
} | ||
|
||
/// Eagerly map the active chunk metadata surrounding `chunk_start` | ||
fn map_active_chunk_metadata(chunk_start: Address) { | ||
fn map_active_chunk_metadata(chunk_start: Address, space_name: &str) { | ||
debug_assert!(chunk_start.is_aligned_to(BYTES_IN_CHUNK)); | ||
// We eagerly map 16Gb worth of space for the chunk mark bytes on 64-bits | ||
// We require saturating subtractions in order to not overflow the chunk_start by | ||
|
@@ -99,16 +99,20 @@ fn map_active_chunk_metadata(chunk_start: Address) { | |
chunk_start + (size / 2) | ||
); | ||
|
||
assert!( | ||
CHUNK_METADATA.try_map_metadata_space(start, size).is_ok(), | ||
"failed to mmap meta memory" | ||
); | ||
CHUNK_METADATA | ||
.try_map_metadata_space(start, size, space_name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is good refactoring with clear improvement. The old code put the actual action performed in the |
||
.unwrap_or_else(|e| panic!("failed to mmap meta memory: {e}")); | ||
} | ||
|
||
/// We map the active chunk metadata (if not previously mapped), as well as the VO bit metadata | ||
/// and active page metadata here. Note that if [addr, addr + size) crosses multiple chunks, we | ||
/// will map for each chunk. | ||
pub(super) fn map_meta_space(metadata: &SideMetadataContext, addr: Address, size: usize) { | ||
pub(super) fn map_meta_space( | ||
metadata: &SideMetadataContext, | ||
addr: Address, | ||
size: usize, | ||
space_name: &str, | ||
) { | ||
// In order to prevent race conditions, we synchronize on the lock first and then | ||
// check if we need to map the active chunk metadata for `chunk_start` | ||
let _lock = CHUNK_MAP_LOCK.lock().unwrap(); | ||
|
@@ -118,7 +122,7 @@ pub(super) fn map_meta_space(metadata: &SideMetadataContext, addr: Address, size | |
// Check if the chunk bit metadata is mapped. If it is not mapped, map it. | ||
// Note that the chunk bit metadata is global. It may have been mapped because other policy mapped it. | ||
if !is_chunk_mapped(start) { | ||
map_active_chunk_metadata(start); | ||
map_active_chunk_metadata(start, space_name); | ||
} | ||
|
||
// If we have set the chunk bit, return. This is needed just in case another thread has done this before | ||
|
@@ -131,7 +135,8 @@ pub(super) fn map_meta_space(metadata: &SideMetadataContext, addr: Address, size | |
// Note that this might fail. For example, we have marked a chunk as active but later we freed all | ||
// the objects in it, and unset its chunk bit. However, we do not free its metadata. So for the chunk, | ||
// its chunk bit is mapped, but not marked, and all its local metadata is also mapped. | ||
let mmap_metadata_result = metadata.try_map_metadata_space(start, BYTES_IN_CHUNK); | ||
let mmap_metadata_result = | ||
metadata.try_map_metadata_space(start, BYTES_IN_CHUNK, space_name); | ||
debug_assert!( | ||
mmap_metadata_result.is_ok(), | ||
"mmap sidemetadata failed for chunk_start ({})", | ||
|
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.