From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH for-next 5/9] io_uring: combine poll tw handlers
Date: Wed, 30 Nov 2022 15:21:55 +0000 [thread overview]
Message-ID: <482e59edb9fc81bd275fdbf486837330fb27120a.1669821213.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
Merge apoll and regular poll tw handlers, it will help with inlining.
Signed-off-by: Pavel Begunkov <[email protected]>
---
io_uring/poll.c | 54 +++++++++++++++++++------------------------------
1 file changed, 21 insertions(+), 33 deletions(-)
diff --git a/io_uring/poll.c b/io_uring/poll.c
index 8f16d2a48ff8..ee7da6150ec4 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -321,50 +321,38 @@ static void io_poll_task_func(struct io_kiocb *req, bool *locked)
ret = io_poll_check_events(req, locked);
if (ret == IOU_POLL_NO_ACTION)
return;
-
- if (ret == IOU_POLL_DONE) {
- struct io_poll *poll = io_kiocb_to_cmd(req, struct io_poll);
- req->cqe.res = mangle_poll(req->cqe.res & poll->events);
- } else if (ret != IOU_POLL_REMOVE_POLL_USE_RES) {
- req->cqe.res = ret;
- req_set_fail(req);
- }
-
io_poll_remove_entries(req);
io_poll_tw_hash_eject(req, locked);
- io_req_set_res(req, req->cqe.res, 0);
- io_req_task_complete(req, locked);
-}
+ if (req->opcode == IORING_OP_POLL_ADD) {
+ if (ret == IOU_POLL_DONE) {
+ struct io_poll *poll;
-static void io_apoll_task_func(struct io_kiocb *req, bool *locked)
-{
- int ret;
-
- ret = io_poll_check_events(req, locked);
- if (ret == IOU_POLL_NO_ACTION)
- return;
-
- io_tw_lock(req->ctx, locked);
- io_poll_remove_entries(req);
- io_poll_tw_hash_eject(req, locked);
+ poll = io_kiocb_to_cmd(req, struct io_poll);
+ req->cqe.res = mangle_poll(req->cqe.res & poll->events);
+ } else if (ret != IOU_POLL_REMOVE_POLL_USE_RES) {
+ req->cqe.res = ret;
+ req_set_fail(req);
+ }
- if (ret == IOU_POLL_REMOVE_POLL_USE_RES)
+ io_req_set_res(req, req->cqe.res, 0);
io_req_task_complete(req, locked);
- else if (ret == IOU_POLL_DONE)
- io_req_task_submit(req, locked);
- else
- io_req_defer_failed(req, ret);
+ } else {
+ io_tw_lock(req->ctx, locked);
+
+ if (ret == IOU_POLL_REMOVE_POLL_USE_RES)
+ io_req_task_complete(req, locked);
+ else if (ret == IOU_POLL_DONE)
+ io_req_task_submit(req, locked);
+ else
+ io_req_defer_failed(req, ret);
+ }
}
static void __io_poll_execute(struct io_kiocb *req, int mask)
{
io_req_set_res(req, mask, 0);
-
- if (req->opcode == IORING_OP_POLL_ADD)
- req->io_task_work.func = io_poll_task_func;
- else
- req->io_task_work.func = io_apoll_task_func;
+ req->io_task_work.func = io_poll_task_func;
trace_io_uring_task_add(req, mask);
io_req_task_work_add(req);
--
2.38.1
next prev parent reply other threads:[~2022-11-30 15:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 15:21 [PATCH for-next 0/9] poll & rsrc quiesce improvements Pavel Begunkov
2022-11-30 15:21 ` [PATCH for-next 1/9] io_uring: kill io_poll_issue's PF_EXITING check Pavel Begunkov
2022-11-30 15:21 ` [PATCH for-next 2/9] io_uring: carve io_poll_check_events fast path Pavel Begunkov
2022-11-30 15:21 ` [PATCH for-next 3/9] io_uring: remove ctx variable in io_poll_check_events Pavel Begunkov
2022-11-30 15:21 ` [PATCH for-next 4/9] io_uring: imporve poll warning handling Pavel Begunkov
2022-11-30 15:21 ` Pavel Begunkov [this message]
2022-11-30 15:21 ` [PATCH for-next 6/9] io_uring: don't raw spin unlock to match cq_lock Pavel Begunkov
2022-11-30 15:21 ` [PATCH for-next 7/9] io_uring: improve rsrc quiesce refs checks Pavel Begunkov
2022-11-30 15:21 ` [PATCH for-next 8/9] io_uring: don't reinstall quiesce node for each tw Pavel Begunkov
2022-11-30 15:21 ` [PATCH for-next 9/9] io_uring: reshuffle issue_flags Pavel Begunkov
2022-11-30 18:07 ` [PATCH for-next 0/9] poll & rsrc quiesce improvements 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=482e59edb9fc81bd275fdbf486837330fb27120a.1669821213.git.asml.silence@gmail.com \
[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