From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 2/5] io_uring/poll: cache req->apoll_events
Date: Tue, 17 Mar 2026 14:35:15 -0600 [thread overview]
Message-ID: <20260317203622.1007183-3-axboe@kernel.dk> (raw)
In-Reply-To: <20260317203622.1007183-1-axboe@kernel.dk>
Avoid a potential reload of ->apoll_events post vfs_poll() by caching it
in a local variable.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/poll.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/io_uring/poll.c b/io_uring/poll.c
index b671b84657d9..4175e63b9edf 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -276,8 +276,10 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)
/* the mask was stashed in __io_poll_execute */
if (!req->cqe.res) {
- struct poll_table_struct pt = { ._key = req->apoll_events };
- req->cqe.res = vfs_poll(req->file, &pt) & req->apoll_events;
+ __poll_t events = req->apoll_events;
+ struct poll_table_struct pt = { ._key = events };
+
+ req->cqe.res = vfs_poll(req->file, &pt) & events;
/*
* We got woken with a mask, but someone else got to
* it first. The above vfs_poll() doesn't add us back
@@ -286,7 +288,7 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)
*/
if (unlikely(!req->cqe.res)) {
/* Multishot armed need not reissue */
- if (!(req->apoll_events & EPOLLONESHOT))
+ if (!(events & EPOLLONESHOT))
continue;
return IOU_POLL_REISSUE;
}
--
2.53.0
next prev parent reply other threads:[~2026-03-17 20:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 20:35 [PATCHSET for-next 0/5] Various minor cleanups Jens Axboe
2026-03-17 20:35 ` [PATCH 1/5] io_uring/kbuf: use 'ctx' consistently Jens Axboe
2026-03-17 20:35 ` Jens Axboe [this message]
2026-03-17 20:35 ` [PATCH 3/5] io_uring/net: " Jens Axboe
2026-03-17 20:35 ` [PATCH 4/5] io_uring/rw: use cached file rather than req->file Jens Axboe
2026-03-17 20:35 ` [PATCH 5/5] io_uring: avoid req->ctx reload in io_req_put_rsrc_nodes() 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=20260317203622.1007183-3-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