Skip to content

arm the 250ms timer only when tickers exist; consider IORING_TIMEOUT_MULTISHOT #99

Description

@MDA2AV

Severity: low — idle-efficiency polish.

Problem

Run() arms the 250 ms IORING_OP_TIMEOUT unconditionally (Reactor.Runner.cs#L65-L68) and OnTimerTick re-arms it forever (Reactor.Loop.DispatchCompletions.cs#L104). With zero registered tickers that's 4 wakeups/second per reactor — 48/s for the default 12 — keeping otherwise fully idle reactors from ever parking quietly.

Suggested fix

  • Arm lazily on the first AddTicker (it's called from OnStart on the reactor thread, so no marshalling needed); skip re-arm when _tickers is empty.
  • Optional: IORING_TIMEOUT_MULTISHOT (1u << 6 in timeout flags, kernel 6.4+, off = 0 for unlimited repeats) drops the re-arm SQE per tick; keep the single-shot re-arm as the pre-6.4 fallback.

Worth doing before idle/keep-alive sweeps (separate hardening issue) make the timer load-bearing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions