fixup for "io_uring: allocate io_kiocb upfront"
Jens Axboe
maintainerPavel,
I didn't read this one closely enough for the latest change, we can't just return -EAGAIN if we don't submit anything, we have to explicitly do it for just the failure case of not getting a request. I'm going to fold in this incremental:
fs/io_uring.c +4 -3
@@ -2978,8 +2978,11 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,unsigned int sqe_flags; req =io_get_req (ctx, statep); -if (unlikely (!req)) +if (unlikely (!req)) { +if (!submitted) + submitted = -EAGAIN ;break ; + }if (!io_get_sqring (ctx, &req->submit)) {__io_free_req (req);break ;
@@ -4316,8 +4319,6 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, cur_mm = ctx->sqo_mm; submitted =io_submit_sqes (ctx, to_submit, f.file, fd, &cur_mm, false); -if (!submitted) - submitted = -EAGAIN ;mutex_unlock (&ctx->uring_lock); }if (flags &IORING_ENTER_GETEVENTS ) {
Signature · 1 line
Jens Axboe
Quoted 7 lines · Jens Axboe
Pavel,
I didn't read this one closely enough for the latest change, we can't just return
-EAGAINif we don't submit anything, we have to explicitly do it for just the failure case of not getting a request. I'm going to fold in this incremental:
My bad, it should be a common case to have @to_submit >= nr_sqes_in_ring (i.e. I don't care, just submit all). Thanks for fixing it. Also, if it submitted @n (>0), and can't allocate for @n+1, I'd rather prefer to get submitted count.
BTW, I found this "one return value for both submit() and wait_cqes()" a bit confusing. In addition, there is reporting through cqe, and sometimes they could be interchanged like in this case. It's getting even more trickier with links.
Maybe, you have some write-up on what to expect from this perspective? Don't remember it to be in the pdf.
Quoted 27 lines
fs/io_uring.c +4
-3@@ -2978,8 +2978,11 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,unsigned int sqe_flags; req =io_get_req (ctx, statep); -if (unlikely (!req)) +if (unlikely (!req)) { +if (!submitted) + submitted = -EAGAIN ;break ; + }if (!io_get_sqring (ctx, &req->submit)) {__io_free_req (req);break ;@@ -4316,8 +4319,6 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, cur_mm = ctx->sqo_mm; submitted =io_submit_sqes (ctx, to_submit, f.file, fd, &cur_mm, false); -if (!submitted) - submitted = -EAGAIN ;mutex_unlock (&ctx->uring_lock); }if (flags &IORING_ENTER_GETEVENTS ) {
Signature · 1 line
Pavel Begunkov