Skip to content

Unsafe scmutex#2777

Closed
sporksmith wants to merge 15 commits intoshadow:mainfrom
sporksmith:unsafe-scmutex
Closed

Unsafe scmutex#2777
sporksmith wants to merge 15 commits intoshadow:mainfrom
sporksmith:unsafe-scmutex

Conversation

@sporksmith
Copy link
Copy Markdown
Contributor

This is an alternative to #2775 that removes the "reading" and "writing" states of SelfContainedChannel. Hopefully that will improve performance. The downside is that send and receive become unsafe, since we will have undefined behavior in the case of parallel calls to send or to receive.

This changes the names to match what cbindgen wants to call these when
we migrate this enum to Rust. (I tried instead adding cbindgen
annotations to a Rust version of the enum, but it doesn't seem to work).
Notably this removes the user-facing experimental options
`preload_spin_max` and `use_explicit_block_message`, and hard-wires the
current defaults of not spinning and not using an explicit block message
(which would be redundant with spinning disabled).

We've stopped using these options, and I haven't bothered reimplementing
them in the Rust version of `IPCData`.
We can use ShimEvent's discriminant directly instead of maintaining a
mapping.
@github-actions github-actions bot added Component: Documentation In-repository documentation, under docs/ Component: Libraries Support functions like LD_PRELOAD and logging Component: Main Composing the core Shadow executable labels Mar 2, 2023
@sporksmith
Copy link
Copy Markdown
Contributor Author

This gets back a little bit of performance, but still a little worse than nightly:

$ tornettools plot nightly/tornet-0.05-1/ 2023-03-01-T18-40-39/tornet-0.05-1/ 2023-03-03-T14-26-23/tornet-0.05-1 -l nightly rust-scmutex rust-scmutex-unsafe

image

@sporksmith sporksmith mentioned this pull request Mar 14, 2023
@sporksmith
Copy link
Copy Markdown
Contributor Author

I think the improvement here is an illusion. It doesn't show up in microbenchmarks, and the current version of IPC using SelfContainedMutex now appears to have the same performance as the C version. https://github.com/shadow/benchmark-results/blob/master/tor/2023-03-16-T13-26-54/plots/run_time.png

@sporksmith sporksmith closed this Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Documentation In-repository documentation, under docs/ Component: Libraries Support functions like LD_PRELOAD and logging Component: Main Composing the core Shadow executable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant