-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Meta-issue on asynchronous action handling in multicore #10915
Copy link
Copy link
Closed
Description
Related issues
- caml_process_pending_actions_exn is missing ocaml-multicore/ocaml-multicore#791
- Unify GC interrupt and signals triggering mechanisms ocaml-multicore/ocaml-multicore#806
- This series of review comments: Multicore OCaml #10831 (review)
Action points
First in any order:
- Review the diff of
finaliser.cbetween multicore and old trunk to make sure nothing is missing; reimplementcaml_final_do_calls_exn. - Separate signalling from payload for inter-domain interrupts. Record the request for an interrupt separately from young_limit to distinguish the various asynchronous actions to perform when an allocation fails.
- Discuss atomicity of young_limit (Multicore OCaml #10831 (comment)).
Then (in order):
-
caml_alloc_small_dispatchis a common entry point to the GC (restore its subtle logic) - Reimplement
caml_do_pending_actions_exn/caml_process_pending_actions_exn - Minimise the diff with old trunk (check that nothing misses; preserve relevant bits of memprof implementation to avoid to forget things later on); make sure that there is no unjustified change to
caml/signals.handcaml/alloc.h.
I think those are a pre-requisite for 5.0 (public API in actual use and the documented way to poll in long-running C functions). If not possible, at the very least, caml_process_pending_actions_exn should be reintroduced with a partial implementation.
Checklist for expected behaviours
The following are needed for 5.0:
-
caml_check_urgent_gcruns pending GC actions including inter-domain interrupts; no asynchronous callbacks. Idem when handling an inter-domain interrupt. - A function
update_young_limitsis used to locally set young_limit to the right value according to various pending action flags (signals, finalisers, inter-domain interrupts...), to make sure young_limit is always set to the right value. -
caml_process_pending_actions_exndoes not raise directly into OCaml. -
caml_do_pending_actions_exninforms of possible future actions if interrupted by an exception. - finalisers do not run immediately when allocating from C; restore the guarantee at the top of
caml/alloc.h. - Reintroduce
caml_something_to_doand its logic? - Events are properly stopped in case of an asynchronous exception inside
runtime/gc_ctrl.c. -
caml_leave_blocking_sectionchecks for signals like it used to. -
Gc.alarmswork as intended.
The following are not strictly needed for 5.0 (but most are likely fixed along with the rest).
- OCaml signal handlers are guaranteed to be run as soon as possible.
- No need for
caml_handle_gc_interrupts_no_async. -
caml_process_pending_actions*is the single entry point to run all pending actions (no separatecaml_process_pending_signals*). - When recording a backtrace, no need to assume that finalisers could run.
- The VM polls by comparing young_limit to young_ptr; investigate Use a bit-vector to record pending signals #10880 (comment).
(cc @sadiqj, @jhjourdan)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels