-
Couldn't load subscription status.
- Fork 228
mpmc: Document #583 and add corresponding loom test #620
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| #[cfg(not(any(feature = "portable-atomic", loom)))] | ||
| use core::sync::atomic; | ||
| #[cfg(feature = "portable-atomic")] |
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.
| #[cfg(feature = "portable-atomic")] | |
| #[cfg(all(feature = "portable-atomic", not(loom)))] |
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.
I don't think it ever makes sense to have loom and portable-atomic running.
Maybe we can add a compile_error! that prevents any use of --cfg loom outside of the expected feature combination.
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.
Whichever you prefer, I just added the change here since you added the conditional compilation above for core::sync::atomic. Without the conditional compilation selector, or the compile_error it's possible to combine both (though it result in a different error about a name conflict).
|
I think
For instance, I used a real-time scheduler (via thread-priority) to test my wCQ implementation. The same |
|
Thanks for your work on this issue. If you can't get loom to work because there are too many branches even in a correct implementation that doesn't spin it might make sense to drop it. Regarding WCQ, it appears to be a lot more code, probably a measurable increase in the compiled binary, and a radical change in the API (using a limited set of handles and a second const-generics instead of being able to dequeue/enqueue simply with a reference). |
No worries, thanks for your continued review/feedback :)
Yeah, I think we're running into a common corner case, as there a few issues on their project related to the spinlock error. Tried the suggestion from one of the issue replies, recommending to use the Even boosting
Completely agree, those were also my biggest concerns. The algorithm is very different, and the code size is at least 300% of the current implementation. Some of that can probably be trimmed down, but even the original C implementation is around 1k LoC. I also implemented the nblfq algorithm which is much closer to the current implementation in both algorithm and code size. After adding the same tests to see if it passes the real-time scheduler tests, It would also mean less review, because it is basically just a bounded retry loop around the main
I would be happy to talk about it in the next WG meeting. Personally, I think the However, if the The main advantage, as I understand, is that the |
a9ecc6f to
4e79620
Compare
This patch documents rust-embedded#583 adds failing loom tests to exercise rust-embedded#583 hoping that a future algorithm change can make them pass. The tests are ran in CI but their results is ignored for now as they fail. Ideally the `loom` tests will cover more usage of `mpmc::Queue` in the future and also cover `spsc`.
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.
Given the loom tests don't currently pass, I'd split their addition in a separate PR and not merge them until they're fixed (I don't see a reason for tests that don't yet pass).
This patch documents the issue reported in #583 and adds failing loom tests to exercise #583 hoping that a future algorithm change can make them pass.
The tests are ran in CI but their results is ignored for now as they fail.
Ideally the
loomtests will cover more usage ofmpmc::Queuein the future and also coverspsc.