-
Notifications
You must be signed in to change notification settings - Fork 107
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
Change last_dependent_accesses
for atomics
#90
Conversation
Example program:
Should print these messages when executed:
|
For
So this patch considers |
Forgot to check if this has any effect on tests in Tokio. Investigating, will report back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation made the (obviously incorrect) assumption that atomic objects were always acquire / release. When using acquire / release, then concurrent stores are independent.
While this change will result in redundant paths being explored when using acquire / release atomics, it should not result in incorrect behavior. It will fix atomics used with SeqCst ordering.
Thanks for catching this 👍
@nkaretnikov let me know when you validate the change w/ Tokio and I can merge. |
Consider the following program (`x` is a shared variable, the `SeqCst` ordering is assumed): * thread 0 (main): store 0 in x * thread 1: store 1 in x * thread 2: store 2 in x * thread 0 (main): wait for thread 1; wait for thread 2; load x Without this change, concurrent writes are considered independent, so Loom fails to explore `store 2` followed by `store 1`. For orderings other than `SeqCst`, this is likely to introduce redundant dependencies, resulting in more thread interleavings being explored than necessary.
Rebased my Loom branch on top of the current master (and force-pushed). Made these changes in Tokio:
Ran this (as done in
No failures reported. Is this how you typically test it? |
Yep, that looks good 👍 No need to rebase in the future. I can do that when the PR merges 👍 |
@carllerche Okay, noted! |
Consider the following program (
x
is a shared variable, theSeqCst
ordering is assumed):
Without this change, concurrent writes are considered independent, so
Loom fails to explore
store 2
followed bystore 1
.For orderings other than
SeqCst
, this is likely to introduceredundant dependencies, resulting in more thread interleavings being
explored than necessary.