public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Cc: [email protected], [email protected]
Subject: Re: [PATCH 5/5] io_uring/epoll: add support for IORING_OP_EPOLL_WAIT
Date: Mon, 24 Feb 2025 14:17:39 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 2/19/25 17:22, Jens Axboe wrote:
> For existing epoll event loops that can't fully convert to io_uring,
> the used approach is usually to add the io_uring fd to the epoll
> instance and use epoll_wait() to wait on both "legacy" and io_uring
> events. While this work, it isn't optimal as:
> 
> 1) epoll_wait() is pretty limited in what it can do. It does not support
>     partial reaping of events, or waiting on a batch of events.
> 
> 2) When an io_uring ring is added to an epoll instance, it activates the
>     io_uring "I'm being polled" logic which slows things down.
> 
> Rather than use this approach, with EPOLL_WAIT support added to io_uring,
> event loops can use the normal io_uring wait logic for everything, as
> long as an epoll wait request has been armed with io_uring.
> 
> Note that IORING_OP_EPOLL_WAIT does NOT take a timeout value, as this
> is an async request. Waiting on io_uring events in general has various
> timeout parameters, and those are the ones that should be used when
> waiting on any kind of request. If events are immediately available for
> reaping, then This opcode will return those immediately. If none are
> available, then it will post an async completion when they become
> available.
> 
> cqe->res will contain either an error code (< 0 value) for a malformed
> request, invalid epoll instance, etc. It will return a positive result
> indicating how many events were reaped.
> 
> IORING_OP_EPOLL_WAIT requests may be canceled using the normal io_uring
> cancelation infrastructure.

Looks quite trivial now! Should be pretty easy to add
multishot on top.

Reviewed-by: Pavel Begunkov <[email protected]>

-- 
Pavel Begunkov


  reply	other threads:[~2025-02-24 14:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-02-20  9:21 ` (subset) [PATCHSET v4 0/7] io_uring epoll wait support Christian Brauner
2025-02-20 15:15   ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox