All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Stefan Bühler" <source@stbuehler.de>
To: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH v1 1/1] [io_uring] don't stall on submission errors
Date: Wed,  1 May 2019 13:49:55 +0200	[thread overview]
Message-ID: <20190501114955.13103-1-source@stbuehler.de> (raw)
In-Reply-To: <fc1f2755-2c79-f5de-4057-ff658f3919ca@kernel.dk>

Stalling is buggy right now, because it might wait for too many events;
for proper stalling we'd need to know how many submissions we ignored,
and reduce min_complete by that amount.

Easier not to stall at all.

Also fix some local variable names.

Should probably be merged with commit
fd25de20d38dd07e2ce7108986f1fd08f9bf03d4:
    io_uring: have submission side sqe errors post a cqe

Signed-off-by: Stefan Bühler <source@stbuehler.de>
---
 fs/io_uring.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index e614a675a1e0..17eae94a54fc 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1846,7 +1846,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, struct sqe_submit *sqes,
 			  unsigned int nr, bool has_user, bool mm_fault)
 {
 	struct io_submit_state state, *statep = NULL;
-	int ret, i, submitted = 0;
+	int ret, i, inflight = 0;
 
 	if (nr > IO_PLUG_THRESHOLD) {
 		io_submit_state_start(&state, ctx, nr);
@@ -1863,7 +1863,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, struct sqe_submit *sqes,
 			ret = io_submit_sqe(ctx, &sqes[i], statep);
 		}
 		if (!ret) {
-			submitted++;
+			inflight++;
 			continue;
 		}
 
@@ -1873,7 +1873,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, struct sqe_submit *sqes,
 	if (statep)
 		io_submit_state_end(&state);
 
-	return submitted;
+	return inflight;
 }
 
 static int io_sq_thread(void *data)
@@ -2011,7 +2011,7 @@ static int io_sq_thread(void *data)
 static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit)
 {
 	struct io_submit_state state, *statep = NULL;
-	int i, submit = 0;
+	int i, submitted = 0;
 
 	if (to_submit > IO_PLUG_THRESHOLD) {
 		io_submit_state_start(&state, ctx, to_submit);
@@ -2028,12 +2028,11 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit)
 		s.has_user = true;
 		s.needs_lock = false;
 		s.needs_fixed_file = false;
-		submit++;
+		submitted++;
 
 		ret = io_submit_sqe(ctx, &s, statep);
 		if (ret) {
 			io_cqring_add_event(ctx, s.sqe->user_data, ret, 0);
-			break;
 		}
 	}
 	io_commit_sqring(ctx);
@@ -2041,7 +2040,7 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit)
 	if (statep)
 		io_submit_state_end(statep);
 
-	return submit;
+	return submitted;
 }
 
 static unsigned io_cqring_events(struct io_cq_ring *ring)
@@ -2779,15 +2778,6 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
 
 		min_complete = min(min_complete, ctx->cq_entries);
 
-		/*
-		 * The application could have included the 'to_submit' count
-		 * in how many events it wanted to wait for. If we failed to
-		 * submit the desired count, we may need to adjust the number
-		 * of events to poll/wait for.
-		 */
-		if (submitted < to_submit)
-			min_complete = min_t(unsigned, submitted, min_complete);
-
 		if (ctx->flags & IORING_SETUP_IOPOLL) {
 			mutex_lock(&ctx->uring_lock);
 			ret = io_iopoll_check(ctx, &nr_events, min_complete);
-- 
2.20.1


  reply	other threads:[~2019-05-01 11:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 19:06 io_uring: not good enough for release Stefan Bühler
2019-04-23 20:31 ` Jens Axboe
2019-04-23 22:07   ` Jens Axboe
2019-04-24 16:09     ` Jens Axboe
2019-04-27 16:05       ` io_uring: RWF_NOWAIT support Stefan Bühler
2019-04-27 18:34         ` [PATCH v1 1/1] [io_uring] fix handling SQEs requesting NOWAIT Stefan Bühler
2019-04-30 15:40           ` Jens Axboe
2019-04-27 15:50     ` io_uring: submission error handling Stefan Bühler
2019-04-30 16:02       ` Jens Axboe
2019-04-30 16:15         ` Jens Axboe
2019-04-30 18:15           ` Stefan Bühler
2019-04-30 18:42             ` Jens Axboe
2019-05-01 11:49               ` Stefan Bühler [this message]
2019-05-01 12:43                 ` [PATCH v1 1/1] [io_uring] don't stall on submission errors Jens Axboe
2019-04-27 21:07   ` io_uring: closing / release Stefan Bühler
2019-05-11 16:26     ` Stefan Bühler
2019-04-28 15:54   ` io_uring: O_NONBLOCK/IOCB_NOWAIT/RWF_NOWAIT mess Stefan Bühler
2019-05-11 16:34     ` Stefan Bühler
2019-05-11 16:57       ` [PATCH 1/5] fs: RWF flags override default IOCB flags from file flags Stefan Bühler
2019-05-11 16:57         ` [PATCH 2/5] tcp: handle SPLICE_F_NONBLOCK in tcp_splice_read Stefan Bühler
2019-05-11 16:57         ` [PATCH 3/5] pipe: use IOCB_NOWAIT instead of O_NONBLOCK Stefan Bühler
2019-05-11 16:57         ` [PATCH 4/5] socket: " Stefan Bühler
2019-05-11 16:57         ` [PATCH 5/5] io_uring: use FMODE_NOWAIT to detect files supporting IOCB_NOWAIT Stefan Bühler
2019-05-03  9:47   ` [PATCH 1/2] io_uring: restructure io_{read,write} control flow Stefan Bühler
2019-05-03  9:47     ` [PATCH 2/2] io_uring: punt to workers if file doesn't support async Stefan Bühler

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=20190501114955.13103-1-source@stbuehler.de \
    --to=source@stbuehler.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@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 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.