use IORING_OP_MSG_RING instead of eventfds to notify specific
With Linux 5.18 io_uring supports sending notifications between io_urings. This removes the need of writing to a specific eventfd to notify specific sleeping workers. This greatly reduces the complexity of the sued algorithm because we do not longer need to prepare two sleeps in an atomic way. The notify specific algorithm no can be similar to the one used by the semaphore implementation. The notifier sets the state of the specific worker to Notified and if its was previously sleeping it is responsible to send a wakeup message. When a worker is going to sleep it sets its state to Running if it was notified the state is reset and the sleep attempt skipped. Otherwise a global read is prepared if needed and the worker waits on its io_uring.
Showing
- emper/sleep_strategy/AbstractIoSleepStrategy.cpp 61 additions, 52 deletionsemper/sleep_strategy/AbstractIoSleepStrategy.cpp
- emper/sleep_strategy/AbstractIoSleepStrategy.hpp 23 additions, 70 deletionsemper/sleep_strategy/AbstractIoSleepStrategy.hpp
- emper/sleep_strategy/PipeSleepStrategy.cpp 1 addition, 1 deletionemper/sleep_strategy/PipeSleepStrategy.cpp
- emper/sleep_strategy/WaitfdSleepStrategy.cpp 2 additions, 6 deletionsemper/sleep_strategy/WaitfdSleepStrategy.cpp
- tests/ScheduleOnTest.cpp 9 additions, 1 deletiontests/ScheduleOnTest.cpp
Please register or sign in to comment