romange / helio

A modern framework for backend development based on io_uring Linux interface
Apache License 2.0
447 stars 50 forks source link

Remove spurious wakeup notifications #93

Closed romange closed 1 year ago

romange commented 1 year ago

The fix addresses #92

Specifically, it introduces a dedicated WaitQueue and Waiter objects that allow registering into a wait list before suspending. Now, FiberInterface::wait_link was removed and fibers register via intrusive Waiter object on stack.

Moreover, the old approach of preventing the double booking int remote ready queue was removed and now we prevent double booking by unloading remote-ready queue in case the active fiber was added to it.

I also introduced an epoch-based notification mechanism, but I am not sure it's needed so I added LOG(FATAL) check to test it. We should notify exactly once based on the WaitQueue and we should not have dangling notifications, therefore I expect we won't have late notifications now.