public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 1/3] io_uring: clean up io_poll_task_func()
Date: Fri,  9 Apr 2021 09:13:19 +0100	[thread overview]
Message-ID: <07902fdec3207f0e11ff8e73b6a16a4a24f7ebac.1617955705.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

io_poll_complete() always fills an event (even an overflowed one), so we
always should do io_cqring_ev_posted() afterwards. And that's what is
currently happening, because second EPOLLONESHOT check is always true,
it can't return !done for oneshots.

Remove those branching, it's much easier to read.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 81e5d156af1c..f662b81bdc22 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4907,20 +4907,18 @@ static void io_poll_task_func(struct callback_head *cb)
 	if (io_poll_rewait(req, &req->poll)) {
 		spin_unlock_irq(&ctx->completion_lock);
 	} else {
-		bool done, post_ev;
+		bool done;
 
-		post_ev = done = io_poll_complete(req, req->result, 0);
+		done = io_poll_complete(req, req->result, 0);
 		if (done) {
 			hash_del(&req->hash_node);
-		} else if (!(req->poll.events & EPOLLONESHOT)) {
-			post_ev = true;
+		} else {
 			req->result = 0;
 			add_wait_queue(req->poll.head, &req->poll.wait);
 		}
 		spin_unlock_irq(&ctx->completion_lock);
+		io_cqring_ev_posted(ctx);
 
-		if (post_ev)
-			io_cqring_ev_posted(ctx);
 		if (done) {
 			nxt = io_put_req_find_next(req);
 			if (nxt)
-- 
2.24.0


  reply	other threads:[~2021-04-09  8:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09  8:13 [PATCH 0/3] first batch of poll cleanups Pavel Begunkov
2021-04-09  8:13 ` Pavel Begunkov [this message]
2021-04-09  8:13 ` [PATCH 2/3] io_uring: refactor io_poll_complete() Pavel Begunkov
2021-04-09  8:13 ` [PATCH 3/3] io_uring: simplify apoll hash removal Pavel Begunkov
2021-04-10 20:44 ` [PATCH 0/3] first batch of poll cleanups Jens Axboe
2021-04-11  0:38   ` Pavel Begunkov
2021-04-11  2:30     ` 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=07902fdec3207f0e11ff8e73b6a16a4a24f7ebac.1617955705.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