All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dylan Yudaken <dylany@meta.com>
To: Jens Axboe <axboe@kernel.dk>, Pavel Begunkov <asml.silence@gmail.com>
Cc: <io-uring@vger.kernel.org>, <kernel-team@fb.com>,
	Dylan Yudaken <dylany@meta.com>
Subject: [PATCH for-next v3 2/9] io_uring: always lock in io_apoll_task_func
Date: Thu, 24 Nov 2022 01:35:52 -0800	[thread overview]
Message-ID: <20221124093559.3780686-3-dylany@meta.com> (raw)
In-Reply-To: <20221124093559.3780686-1-dylany@meta.com>

This is required for the failure case (io_req_complete_failed) and is
missing.

The alternative would be to only lock in the failure path, however all of
the non-error paths in io_poll_check_events that do not do not return
IOU_POLL_NO_ACTION end up locking anyway. The only extraneous lock would
be for the multishot poll overflowing the CQE ring, however multishot poll
would probably benefit from being locked as it will allow completions to
be batched.

So it seems reasonable to lock always.

Signed-off-by: Dylan Yudaken <dylany@meta.com>
---
 io_uring/poll.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/io_uring/poll.c b/io_uring/poll.c
index 4624e5eba63e..42aa10b50f6c 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -308,11 +308,12 @@ static void io_apoll_task_func(struct io_kiocb *req, bool *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);
 
 	if (ret == IOU_POLL_REMOVE_POLL_USE_RES)
-		io_req_complete_post_tw(req, locked);
+		io_req_task_complete(req, locked);
 	else if (ret == IOU_POLL_DONE)
 		io_req_task_submit(req, locked);
 	else
-- 
2.30.2


  parent reply	other threads:[~2022-11-24  9:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24  9:35 [PATCH for-next v3 0/9] io_uring: batch multishot completions Dylan Yudaken
2022-11-24  9:35 ` [PATCH for-next v3 1/9] io_uring: io_req_complete_post should defer if available Dylan Yudaken
2022-11-24 15:56   ` Pavel Begunkov
2022-11-25  9:26     ` Dylan Yudaken
2022-11-24  9:35 ` Dylan Yudaken [this message]
2022-11-24  9:35 ` [PATCH for-next v3 3/9] io_uring: defer all io_req_complete_failed Dylan Yudaken
2022-11-24  9:35 ` [PATCH for-next v3 4/9] io_uring: allow defer completion for aux posted cqes Dylan Yudaken
2022-11-24 16:04   ` Pavel Begunkov
2022-11-24  9:35 ` [PATCH for-next v3 5/9] io_uring: add io_aux_cqe which allows deferred completion Dylan Yudaken
2022-11-24  9:35 ` [PATCH for-next v3 6/9] io_uring: make io_fill_cqe_aux static Dylan Yudaken
2022-11-24  9:35 ` [PATCH for-next v3 7/9] io_uring: add lockdep assertion in io_fill_cqe_aux Dylan Yudaken
2022-11-24  9:35 ` [PATCH for-next v3 8/9] io_uring: remove overflow param from io_post_aux_cqe Dylan Yudaken
2022-11-24  9:35 ` [PATCH for-next v3 9/9] io_uring: allow multishot polled reqs to defer completion Dylan Yudaken
2022-11-24 13:25 ` [PATCH for-next v3 0/9] io_uring: batch multishot completions 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=20221124093559.3780686-3-dylany@meta.com \
    --to=dylany@meta.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=kernel-team@fb.com \
    /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.