-
Notifications
You must be signed in to change notification settings - Fork 1
memory_maps: make impl lock-free using atomics #585
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
Open
kkysen
wants to merge
4
commits into
kkysen/memory-maps-move-global-to-INIT_RUNTIME
Choose a base branch
from
kkysen/memory-maps-better-thread-support
base: kkysen/memory-maps-move-global-to-INIT_RUNTIME
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
memory_maps: make impl lock-free using atomics #585
kkysen
wants to merge
4
commits into
kkysen/memory-maps-move-global-to-INIT_RUNTIME
from
kkysen/memory-maps-better-thread-support
Conversation
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
kkysen
commented
May 27, 2025
kkysen
commented
May 27, 2025
c9bf2da to
09b7ff4
Compare
Contributor
|
Needs a rebase onto |
7cf42ba to
3b9adbf
Compare
234af54 to
fceb2e0
Compare
fceb2e0 to
14cd398
Compare
14cd398 to
51929e2
Compare
51929e2 to
99a0aa3
Compare
99a0aa3 to
533efc2
Compare
2f746d8 to
f3107c2
Compare
533efc2 to
1f29699
Compare
f3107c2 to
e5dcc29
Compare
1f29699 to
c4e1419
Compare
e5dcc29 to
1db4ac5
Compare
c4e1419 to
77361ec
Compare
…on error instead of returning `NULL`
…all_threads_metadata_find_addr`
This reformulates how threading works for memory maps. This gets rid of all of the locks and just uses an atomic counter in exchange for guaranteeing that each thread registers only once at the start (with `ia2_thread_metadata_new_for_current_thread`). `ia2_thread_metadata_new_for_current_thread` is called for the main thread in `ia2_start` and in new threads in `ia2_thread_begin`. Making this lock-free avoids any potential deadlocks and reentrancy issues, meaning the memory map functions can be called in any context, including in a debugger stopped at any point.
1db4ac5 to
100132e
Compare
77361ec to
a153923
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 reformulates how threading works for memory maps. This gets rid of all of the locks and just uses an atomic counter in exchange for guaranteeing that each thread registers only once at the start (with
ia2_thread_metadata_new_for_current_thread).ia2_thread_metadata_new_for_current_threadis called for the main thread inia2_start(now that #561 has merged) and in new threads inia2_thread_begin.Making this lock-free avoids any potential deadlocks and reentrancy issues, meaning the memory map functions can be called in any context, including in a debugger stopped at any point.