Event trigger: eventfd handed over with SCM_RIGHTS to keep WaitSet support?

Brief feature description

We hit the “slower than classic” case from #1790, and for us it is entirely the event path. The semaphore branch fixes the speed but costs us the WaitSet. I built a trigger around an eventfd handed over with SCM_RIGHTS that gets most of the speed back while keeping the listener fd-based, and I’d like to know whether you’d take it upstream.

Detailed information

Our workload. A lock-step pipeline of about a dozen processes, synchronized through events every step: a few hundred listener notifications per step, small payloads. On 0.9.3 it runs about 18% slower than on iceoryx classic. Traces put all of it in notify and listener wake-up; receive is cheaper than classic. About two thirds of the datagrams go to listeners that are not waiting at that moment. Waking 12 sleepers: ~1.56 us each with the datagram trigger, ~0.93 us with the semaphore one.

What we tried.

  • events-with-semaphores from #1790: closes the gap, but we have several places that multiplex a dozen listeners in a WaitSet, and the monotonic timed_wait going through AdaptiveWait doubles CPU for every blocked process.
  • 0.10 notification state: no measurable change for us, since in lock-step every listener consumes before the next notify.

The prototype.

  • Listener: eventfd(EFD_SEMAPHORE) plus a shared-memory wait state (idle / blocked / multiplexed), exposed through one epoll fd together with a signal socket and a handoff socket.
  • Notifier: sends its reply socket path over the handoff socket, receives a duplicate of the eventfd via SCM_RIGHTS, and falls back to plain datagrams until then. No ptrace, no shared pid namespace, works across containers sharing the socket directory.
  • notify activates the id and writes only if the listener is blocked or multiplexed; the waiter announces itself and re-checks the ids before sleeping, SeqCst fences on both sides. Multiplexed listeners keep one unit per notification, so WaitSet wake-ups match the datagram trigger one to one.
  • Result: 18% → ~5% on the small setup, ~5% → ~1.5% on a heavier one, WaitSet users untouched, cross-container tests green.

Questions.

  1. Has an eventfd trigger with fd passing come up before? #1570 proposes SCM_RIGHTS for DMA-BUF, so the mechanism doesn’t seem foreign here.
  2. Any other plan for a WaitSet-compatible semaphore trigger?

Hi @TanWang , appreciate the time taken for this detailed post!

I’d like to know whether you’d take it upstream

Since this is a proposal for a change to be made upstream, would you mind opening an issue so we can track it: Issues · eclipse-iceoryx/iceoryx2 · GitHub

We will be able to discuss in detail over there.