-
Notifications
You must be signed in to change notification settings - Fork 71
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
talex5
force-pushed
the
linux-get-sched
branch
from
September 4, 2024 13:43
0f48f27
to
f8a9c79
Compare
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
force-pushed
the
linux-get-sched
branch
from
September 4, 2024 14:41
f8a9c79
to
cc2cd3d
Compare
talex5
changed the title
eio_linux: refactor fixed buffer core
eio_linux: refactor fixed buffer code
Sep 4, 2024
talex5
added a commit
to talex5/opam-repository
that referenced
this pull request
Nov 23, 2024
CHANGES: Changes: - Make `fork_action.h` a public header (@patricoferris ocaml-multicore/eio#769, reviewed by @talex5). Allows other libraries to add new actions. - Record trace event when spawning processes (@talex5 ocaml-multicore/eio#749). Spawning a subprocess can take a long time in some cases, so show it clearly in the traces. - Eio_unix.Net: make some return types more polymorphic (@talex5 ocaml-multicore/eio#744). Bug fixes: - Preserve backtraces in `fork_daemon` (@talex5 ocaml-multicore/eio#779). - Eio.Path: always use "/" as separator (@talex5 ocaml-multicore/eio#743). Linux backend: - Allow `alloc_fixed_or_wait` to be cancelled (@talex5 ocaml-multicore/eio#753). - Avoid triggering a (harmless) TSan warning (@talex5 ocaml-multicore/eio#754, reported by @avsm). Windows backend: - Unregister FDs on cancel (@talex5 ocaml-multicore/eio#756). Fixes `exception Unix.Unix_error(Unix.ENOTSOCK, "select", "")`. - Work around problems in `Unix.getaddrinfo` (@talex5 ocaml-multicore/eio#780). Fixes e.g. `No addresses found for host name "127.0.0.1"`. - Group `ECONNABORTED` with other connection reset errors (@talex5 ocaml-multicore/eio#783). - Check `has_symlink` for tests (@create2000 ocaml-multicore/eio#771, reviewed by @patricoferris and @talex5). - Improve `openat` error handling (@talex5 ocaml-multicore/eio#742, reported by @kentookura). Fixes `exception Unix.Unix_error(Unix.ENOENT, "openat", "")`. Documentation: - examples/fs: show how to read files while scanning (@talex5 ocaml-multicore/eio#745). - Add example to `Buf_read.seq` documentation (@talex5 ocaml-multicore/eio#739, requested by @darrenldl and @rizo). Build and test: - Fix tests on OpenBSD (@talex5 ocaml-multicore/eio#782). - Add advice about using AI for code generation (@patricoferris ocaml-multicore/eio#765, reviewed by @avsm and @talex5). - Minor code cleanups (@talex5 ocaml-multicore/eio#755). - Define `struct clone_args` for linux-lts versions that don't have it (@copy ocaml-multicore/eio#741, reviewed by @talex5). - eio_linux: refactor fixed buffer code (@talex5 ocaml-multicore/eio#752).
talex5
added a commit
to talex5/opam-repository
that referenced
this pull request
Nov 23, 2024
CHANGES: Changes: - Make `fork_action.h` a public header (@patricoferris ocaml-multicore/eio#769, reviewed by @talex5). Allows other libraries to add new actions. - Record trace event when spawning processes (@talex5 ocaml-multicore/eio#749). Spawning a subprocess can take a long time in some cases, so show it clearly in the traces. - Eio_unix.Net: make some return types more polymorphic (@talex5 ocaml-multicore/eio#744). Bug fixes: - Preserve backtraces in `fork_daemon` (@talex5 ocaml-multicore/eio#779). - Eio.Path: always use "/" as separator (@talex5 ocaml-multicore/eio#743). Linux backend: - Allow `alloc_fixed_or_wait` to be cancelled (@talex5 ocaml-multicore/eio#753). - Avoid triggering a (harmless) TSan warning (@talex5 ocaml-multicore/eio#754, reported by @avsm). Windows backend: - Unregister FDs on cancel (@talex5 ocaml-multicore/eio#756). Fixes `exception Unix.Unix_error(Unix.ENOTSOCK, "select", "")`. - Work around problems in `Unix.getaddrinfo` (@talex5 ocaml-multicore/eio#780). Fixes e.g. `No addresses found for host name "127.0.0.1"`. - Group `ECONNABORTED` with other connection reset errors (@talex5 ocaml-multicore/eio#783). - Check `has_symlink` for tests (@create2000 ocaml-multicore/eio#771, reviewed by @patricoferris and @talex5). - Improve `openat` error handling (@talex5 ocaml-multicore/eio#742, reported by @kentookura). Fixes `exception Unix.Unix_error(Unix.ENOENT, "openat", "")`. Documentation: - examples/fs: show how to read files while scanning (@talex5 ocaml-multicore/eio#745). - Add example to `Buf_read.seq` documentation (@talex5 ocaml-multicore/eio#739, requested by @darrenldl and @rizo). Build and test: - Fix tests on OpenBSD (@talex5 ocaml-multicore/eio#782). - Add advice about using AI for code generation (@patricoferris ocaml-multicore/eio#765, reviewed by @avsm and @talex5). - Minor code cleanups (@talex5 ocaml-multicore/eio#755). - Define `struct clone_args` for linux-lts versions that don't have it (@copy ocaml-multicore/eio#741, reviewed by @talex5). - eio_linux: refactor fixed buffer code (@talex5 ocaml-multicore/eio#752).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of having separate
Alloc
,Alloc_or_wait
andFree
effects, the scheduler now provides a singleGet
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 usesSingle_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).