io_uring/rw: avoid punting to io-wq directly

Commit 6e6b8c6212 upstream.

kiocb_done() should care to specifically redirecting requests to io-wq.
Remove the hopping to tw to then queue an io-wq, return -EAGAIN and let
the core code io_uring handle offloading.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Tested-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/413564e550fe23744a970e1783dfa566291b0e6f.1710799188.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 6e6b8c6212)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Pavel Begunkov 2024-03-18 22:00:28 +00:00 committed by Greg Kroah-Hartman
parent 57cd0416d4
commit 71a7e2f5b6
3 changed files with 4 additions and 11 deletions

View File

@ -434,7 +434,7 @@ static void io_prep_async_link(struct io_kiocb *req)
} }
} }
void io_queue_iowq(struct io_kiocb *req, bool *dont_use) static void io_queue_iowq(struct io_kiocb *req)
{ {
struct io_kiocb *link = io_prep_linked_timeout(req); struct io_kiocb *link = io_prep_linked_timeout(req);
struct io_uring_task *tctx = req->task->io_uring; struct io_uring_task *tctx = req->task->io_uring;
@ -1913,7 +1913,7 @@ static void io_queue_async(struct io_kiocb *req, int ret)
break; break;
case IO_APOLL_ABORTED: case IO_APOLL_ABORTED:
io_kbuf_recycle(req, 0); io_kbuf_recycle(req, 0);
io_queue_iowq(req, NULL); io_queue_iowq(req);
break; break;
case IO_APOLL_OK: case IO_APOLL_OK:
break; break;
@ -1962,7 +1962,7 @@ static void io_queue_sqe_fallback(struct io_kiocb *req)
if (unlikely(req->ctx->drain_active)) if (unlikely(req->ctx->drain_active))
io_drain_req(req); io_drain_req(req);
else else
io_queue_iowq(req, NULL); io_queue_iowq(req);
} }
} }

View File

@ -54,7 +54,6 @@ static inline bool io_req_ffs_set(struct io_kiocb *req)
void __io_req_task_work_add(struct io_kiocb *req, bool allow_local); void __io_req_task_work_add(struct io_kiocb *req, bool allow_local);
bool io_alloc_async_data(struct io_kiocb *req); bool io_alloc_async_data(struct io_kiocb *req);
void io_req_task_queue(struct io_kiocb *req); void io_req_task_queue(struct io_kiocb *req);
void io_queue_iowq(struct io_kiocb *req, bool *dont_use);
void io_req_task_complete(struct io_kiocb *req, bool *locked); void io_req_task_complete(struct io_kiocb *req, bool *locked);
void io_req_task_queue_fail(struct io_kiocb *req, int ret); void io_req_task_queue_fail(struct io_kiocb *req, int ret);
void io_req_task_submit(struct io_kiocb *req, bool *locked); void io_req_task_submit(struct io_kiocb *req, bool *locked);

View File

@ -167,12 +167,6 @@ static inline loff_t *io_kiocb_update_pos(struct io_kiocb *req)
return NULL; return NULL;
} }
static void io_req_task_queue_reissue(struct io_kiocb *req)
{
req->io_task_work.func = io_queue_iowq;
io_req_task_work_add(req);
}
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
static bool io_resubmit_prep(struct io_kiocb *req) static bool io_resubmit_prep(struct io_kiocb *req)
{ {
@ -341,7 +335,7 @@ static int kiocb_done(struct io_kiocb *req, ssize_t ret,
if (req->flags & REQ_F_REISSUE) { if (req->flags & REQ_F_REISSUE) {
req->flags &= ~REQ_F_REISSUE; req->flags &= ~REQ_F_REISSUE;
if (io_resubmit_prep(req)) if (io_resubmit_prep(req))
io_req_task_queue_reissue(req); return -EAGAIN;
else else
io_req_task_queue_fail(req, final_ret); io_req_task_queue_fail(req, final_ret);
} }