Skip to content

Commit 3f0c4ed

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 2d2a1a2 commit 3f0c4ed

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
@@ -411,7 +411,12 @@ EventLoop::UringWait(Event::Duration timeout) noexcept
411411
io_uring_prep_poll_multishot() is edge-triggered, so we
412412
have to consume all events to rearm it */
413413

414-
if (!epoll_ready) {
414+
if (epoll_ready)
415+
/* don't wait for io_uring completions if epoll is
416+
still ready */
417+
timeout = Event::Duration{0};
418+
419+
{
415420
struct __kernel_timespec timeout_buffer;
416421
auto *kernel_timeout = ExportTimeoutKernelTimespec(timeout, timeout_buffer);
417422
Uring::Queue &uring_queue = *uring;

0 commit comments

Comments
 (0)