All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>, io-uring@vger.kernel.org
Subject: Re: [PATCH 2/6] io_uring: add io_file_can_poll() helper
Date: Tue, 6 Feb 2024 19:15:21 -0700	[thread overview]
Message-ID: <b7ef8fd0-de12-4e5e-bb8c-bfa06b2ec723@kernel.dk> (raw)
In-Reply-To: <a0dce2ae-a41b-4fbb-961c-db69d8f1f17f@gmail.com>

On 2/6/24 5:57 PM, Pavel Begunkov wrote:
> On 2/6/24 16:22, Jens Axboe wrote:
>> This adds a flag to avoid dipping dereferencing file and then f_op
>> to figure out if the file has a poll handler defined or not. We
>> generally call this at least twice for networked workloads.
> 
> Sends are not using poll every time. For recv, we touch it
> in io_arm_poll_handler(), which is done only once, and so
> ammortised to 0 for multishots.

Correct

> Looking at the patch, the second time we might care about is
> in io_ring_buffer_select(), but I'd argue that it shouldn't
> be there in the first place. It's fragile, and I don't see
> why selected buffers would care specifically about polling
> but not asking more generally "can it go true async"? For
> reads you might want to also test FMODE_BUF_RASYNC.

That is indeed the second case that is hit, and I don't think we can
easily get around that which is the reason for the hint.

> Also note that when called from recv we already know that
> it's pollable, it might be much easier to pass it in as an
> argument.

I did think about that, but I don't see a clean way to do it. We could
potentially do it as an issue flag, but that seems kind of ugly to me.
Open to suggestions!

-- 
Jens Axboe


  reply	other threads:[~2024-02-07  2:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 16:22 [PATCHSET next 0/6] Misc cleanups / optimizations Jens Axboe
2024-02-06 16:22 ` [PATCH 1/6] io_uring: expand main struct io_kiocb flags to 64-bits Jens Axboe
2024-02-06 22:58   ` Jens Axboe
2024-02-07  0:43   ` Pavel Begunkov
2024-02-07  2:18     ` Jens Axboe
2024-02-07  3:22       ` Pavel Begunkov
2024-02-06 16:22 ` [PATCH 2/6] io_uring: add io_file_can_poll() helper Jens Axboe
2024-02-07  0:57   ` Pavel Begunkov
2024-02-07  2:15     ` Jens Axboe [this message]
2024-02-07  3:33       ` Pavel Begunkov
2024-02-06 16:22 ` [PATCH 3/6] io_uring/cancel: don't default to setting req->work.cancel_seq Jens Axboe
2024-02-06 16:22 ` [PATCH 4/6] io_uring: move io_kiocb->nr_tw into comp_list union Jens Axboe
2024-02-06 16:22 ` [PATCH 5/6] io_uring: mark the need to lock/unlock the ring as unlikely Jens Axboe
2024-02-06 16:22 ` [PATCH 6/6] io_uring/rw: remove dead file == NULL check 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 \
    --in-reply-to=b7ef8fd0-de12-4e5e-bb8c-bfa06b2ec723@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.