Skip to content

Commit 1448ac6

Browse files
committed
event/Loop: don't wait for io_uring if epoll is still ready
This fixes a starvation bug if epoll is getting hammered with completions. This fills the io_uring completion queue until it overflows, but these overflows are never picked up because we never invoke io_uring_enter(). We avoid this by calling io_uring_enter() in any case, but with a zero timeout.
1 parent f4bb050 commit 1448ac6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/event/Loop.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,12 @@ EventLoop::UringWait(Event::Duration timeout) noexcept
415415
io_uring_prep_poll_multishot() is edge-triggered, so we
416416
have to consume all events to rearm it */
417417

418-
if (!epoll_ready) {
418+
if (epoll_ready)
419+
/* don't wait for io_uring completions if epoll is
420+
still ready */
421+
timeout = Event::Duration{0};
422+
423+
{
419424
struct __kernel_timespec timeout_buffer;
420425
auto *kernel_timeout = ExportTimeoutKernelTimespec(timeout, timeout_buffer);
421426
Uring::Queue &uring_queue = *uring;

0 commit comments

Comments
 (0)