Skip to content
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

Use compareAndExchange() in obvious places #179

Merged
merged 5 commits into from
Jan 17, 2025
Merged

Conversation

rovarga
Copy link
Collaborator

@rovarga rovarga commented Jan 17, 2025

  • Use local variable type inference INode
  • Use compareAndExchange() in casRoot()
  • Improve rdcssComplete()
  • Improve rdcssComplete() loop
  • Use compareAndExchange() in gcasComplete()

Fixes #178.

We have a few spots where we missed the opportunity to be more concise.
Fix that up.

Signed-off-by: Robert Varga <[email protected]>
compareAndExchange() is better than compareAndSwap() in that it provides
the witness value.

Switching casRoot() to this paradigm allows us to speed up speed up
retries in rdcssComplete().

Signed-off-by: Robert Varga <[email protected]>
There are only two callers, who have the current value readily
available. Use that value instead of reading it again.

Signed-off-by: Robert Varga <[email protected]>
We are entering with a RDCSS_Descriptor, so let's not lose that
information.

The refactored loop is also denser, as we now share the code path taken
for abort case and when the expected main changes.

Signed-off-by: Robert Varga <[email protected]>
compareAndExchange() gives is the witness value, which we can use to
elide a volatile read of main node.

Signed-off-by: Robert Varga <[email protected]>
@rovarga rovarga merged commit 3d6209b into PANTHEONtech:master Jan 17, 2025
2 checks passed
@rovarga rovarga deleted the cae branch January 17, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve atomic operations
1 participant