public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCHSET v4 0/7] io_uring epoll wait support
@ 2025-02-19 17:22 Jens Axboe
  2025-02-19 17:22 ` [PATCH 1/5] eventpoll: abstract out parameter sanity checking Jens Axboe
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Jens Axboe @ 2025-02-19 17:22 UTC (permalink / raw)
  To: io-uring; +Cc: linux-fsdevel, brauner, asml.silence

Hi,

One issue people consistently run into when converting legacy epoll
event loops with io_uring is that parts of the event loop still needs to
use epoll. And since event loops generally need to wait in one spot,
they add the io_uring fd to the epoll set and continue to use
epoll_wait(2) to wait on events. This is suboptimal on the io_uring
front as there's now an active poller on the ring, and it's suboptimal
as it doesn't give the application the batch waiting (with fine grained
timeouts) that io_uring provides.

This patchset adds support for IORING_OP_EPOLL_WAIT, which does an async
epoll_wait() operation. No sleeping or thread offload is involved, it
relies on the internal poll infrastructure that io_uring uses to drive
retries on pollable entities. With that, then the above event loops can
continue to use epoll for certain parts, but bundle it all under waiting
on the ring itself rather than add the ring fd to the epoll set.

Patches 1..2 are just prep patches, and patch 3 adds the epoll change
to allow io_uring to queue a callback, if no events are available. Patch
4 is just prep the io_uring side, and patch 5 finally adds
IORING_OP_EPOLL_WAIT support

Patches can also be found here:

https://git.kernel.dk/cgit/linux/log/?h=io_uring-epoll-wait

and are against 6.14-rc3 + already pending io_uring patches.

 fs/eventpoll.c                | 87 +++++++++++++++++++++++++----------
 include/linux/eventpoll.h     |  4 ++
 include/uapi/linux/io_uring.h |  1 +
 io_uring/Makefile             |  9 ++--
 io_uring/epoll.c              | 35 +++++++++++++-
 io_uring/epoll.h              |  2 +
 io_uring/opdef.c              | 14 ++++++
 7 files changed, 122 insertions(+), 30 deletions(-)

Since v3:
- Base on poll infrastructure rather than rolling our own, thanks to
  Pavel's suggestion.
- Rebase on top of 6.15 changes, which shifted the opcode value due
  to the addition of zc rx.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-02-24 14:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19 17:22 [PATCHSET v4 0/7] io_uring epoll wait support Jens Axboe
2025-02-19 17:22 ` [PATCH 1/5] eventpoll: abstract out parameter sanity checking Jens Axboe
2025-02-19 17:22 ` [PATCH 2/5] eventpoll: abstract out ep_try_send_events() helper Jens Axboe
2025-02-19 17:22 ` [PATCH 3/5] eventpoll: add epoll_sendevents() helper Jens Axboe
2025-02-19 17:22 ` [PATCH 4/5] io_uring/epoll: remove CONFIG_EPOLL guards Jens Axboe
2025-02-19 17:22 ` [PATCH 5/5] io_uring/epoll: add support for IORING_OP_EPOLL_WAIT Jens Axboe
2025-02-24 14:17   ` Pavel Begunkov
2025-02-20  9:21 ` (subset) [PATCHSET v4 0/7] io_uring epoll wait support Christian Brauner
2025-02-20 15:15   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox