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

eio_linux: refactor fixed buffer code #752

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

talex5
Copy link
Collaborator

@talex5 talex5 commented Sep 4, 2024

Instead of having separate Alloc, Alloc_or_wait and Free effects, the scheduler now provides a single Get effect to return itself, and the actual work is now done in the calling fiber. This is a first step to align better with Picos's trigger mechanism (it actually uses Single_waiter, Eio's non-thread-safe equivalent, which is fine here). It seems to be slightly faster too, though that could just be noise.

It would be possible to use DLS to store the scheduler rather than using an effect. However, the improvement in speed is minimal and there are some complications with sys-threads, so probably better to wait for OCaml to support thread-local-storage first.

Note that the wait is non-cancellable at the moment (it was like that before too).

@talex5 talex5 marked this pull request as draft September 4, 2024 13:40
Instead of having separate Alloc, Alloc_or_wait and Free effects,
the scheduler now provides a single Get effect to return itself,
and the actual work is now done in the calling fiber. This is cleaner,
and seems to be slightly faster too.

Note that `alloc_fixed_or_wait` is currently not cancellable (it wasn't
before either, but it's more obvious now).

It would be possible to use DLS to store the scheduler rather than using
an effect. However, the improvement in speed is minimal and there are
some complications with sys-threads, so probably better to wait for
OCaml to support thread-local-storage first.
@talex5 talex5 changed the title eio_linux: refactor fixed buffer core eio_linux: refactor fixed buffer code Sep 4, 2024
@talex5 talex5 marked this pull request as ready for review September 5, 2024 10:04
@talex5 talex5 merged commit 0f6b65d into ocaml-multicore:main Sep 5, 2024
5 checks passed
@talex5 talex5 deleted the linux-get-sched branch September 5, 2024 10:07
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.

1 participant