io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 1/2] io_uring/poll: flag request with REQ_F_POLL_TRIGGERED if it went through poll
Date: Wed,  5 Nov 2025 12:30:58 -0700	[thread overview]
Message-ID: <20251105193639.235441-2-axboe@kernel.dk> (raw)
In-Reply-To: <20251105193639.235441-1-axboe@kernel.dk>

If a request targeting a pollable file cannot get executed without
needing to wait for a POLLIN/POLLOUT trigger, then flag it with
REQ_F_POLL_TRIGGERED. Only supported for non-multishot requests, as it's
fully expected that multishot will always end up going through poll.

No functional changes in this patch, just in preparation for using this
information elsewhere.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 include/linux/io_uring_types.h | 3 +++
 io_uring/poll.c                | 1 +
 2 files changed, 4 insertions(+)

diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
index 92780764d5fa..ef1af730193a 100644
--- a/include/linux/io_uring_types.h
+++ b/include/linux/io_uring_types.h
@@ -521,6 +521,7 @@ enum {
 	REQ_F_HAS_METADATA_BIT,
 	REQ_F_IMPORT_BUFFER_BIT,
 	REQ_F_SQE_COPIED_BIT,
+	REQ_F_POLL_TRIGGERED_BIT,
 
 	/* not a real bit, just to check we're not overflowing the space */
 	__REQ_F_LAST_BIT,
@@ -612,6 +613,8 @@ enum {
 	REQ_F_IMPORT_BUFFER	= IO_REQ_FLAG(REQ_F_IMPORT_BUFFER_BIT),
 	/* ->sqe_copy() has been called, if necessary */
 	REQ_F_SQE_COPIED	= IO_REQ_FLAG(REQ_F_SQE_COPIED_BIT),
+	/* poll was triggered at least once for this request */
+	REQ_F_POLL_TRIGGERED	= IO_REQ_FLAG(REQ_F_POLL_TRIGGERED_BIT),
 };
 
 struct io_tw_req {
diff --git a/io_uring/poll.c b/io_uring/poll.c
index 8aa4e3a31e73..d6f7cddf36d0 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -419,6 +419,7 @@ static int io_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
 				req->flags &= ~REQ_F_DOUBLE_POLL;
 			else
 				req->flags &= ~REQ_F_SINGLE_POLL;
+			req->flags |= REQ_F_POLL_TRIGGERED;
 		}
 		__io_poll_execute(req, mask);
 	}
-- 
2.51.0


  reply	other threads:[~2025-11-05 19:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05 19:30 [PATCHSET 0/2] Add support for IORING_CQE_F_SOCK_FULL Jens Axboe
2025-11-05 19:30 ` Jens Axboe [this message]
2025-11-05 19:30 ` [PATCH 2/2] io_uring/net: add IORING_CQE_F_SOCK_FULL if a send needed to poll arm Jens Axboe
2025-11-06 12:19 ` [PATCHSET 0/2] Add support for IORING_CQE_F_SOCK_FULL Pavel Begunkov
2025-11-06 23:24   ` 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=20251105193639.235441-2-axboe@kernel.dk \
    --to=axboe@kernel.dk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).