Skip to content

Commit 71a7e2f

Browse files
isilencegregkh
authored andcommitted
io_uring/rw: avoid punting to io-wq directly
Commit 6e6b8c62120a22acd8cb759304e4cd2e3215d488 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 <[email protected]> Tested-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/413564e550fe23744a970e1783dfa566291b0e6f.1710799188.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]> (cherry picked from commit 6e6b8c62120a22acd8cb759304e4cd2e3215d488) Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 57cd041 commit 71a7e2f

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

io_uring/io_uring.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static void io_prep_async_link(struct io_kiocb *req)
434434
}
435435
}
436436

437-
void io_queue_iowq(struct io_kiocb *req, bool *dont_use)
437+
static void io_queue_iowq(struct io_kiocb *req)
438438
{
439439
struct io_kiocb *link = io_prep_linked_timeout(req);
440440
struct io_uring_task *tctx = req->task->io_uring;
@@ -1913,7 +1913,7 @@ static void io_queue_async(struct io_kiocb *req, int ret)
19131913
break;
19141914
case IO_APOLL_ABORTED:
19151915
io_kbuf_recycle(req, 0);
1916-
io_queue_iowq(req, NULL);
1916+
io_queue_iowq(req);
19171917
break;
19181918
case IO_APOLL_OK:
19191919
break;
@@ -1962,7 +1962,7 @@ static void io_queue_sqe_fallback(struct io_kiocb *req)
19621962
if (unlikely(req->ctx->drain_active))
19631963
io_drain_req(req);
19641964
else
1965-
io_queue_iowq(req, NULL);
1965+
io_queue_iowq(req);
19661966
}
19671967
}
19681968

io_uring/io_uring.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ static inline bool io_req_ffs_set(struct io_kiocb *req)
5454
void __io_req_task_work_add(struct io_kiocb *req, bool allow_local);
5555
bool io_alloc_async_data(struct io_kiocb *req);
5656
void io_req_task_queue(struct io_kiocb *req);
57-
void io_queue_iowq(struct io_kiocb *req, bool *dont_use);
5857
void io_req_task_complete(struct io_kiocb *req, bool *locked);
5958
void io_req_task_queue_fail(struct io_kiocb *req, int ret);
6059
void io_req_task_submit(struct io_kiocb *req, bool *locked);

io_uring/rw.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,6 @@ static inline loff_t *io_kiocb_update_pos(struct io_kiocb *req)
167167
return NULL;
168168
}
169169

170-
static void io_req_task_queue_reissue(struct io_kiocb *req)
171-
{
172-
req->io_task_work.func = io_queue_iowq;
173-
io_req_task_work_add(req);
174-
}
175-
176170
#ifdef CONFIG_BLOCK
177171
static bool io_resubmit_prep(struct io_kiocb *req)
178172
{
@@ -341,7 +335,7 @@ static int kiocb_done(struct io_kiocb *req, ssize_t ret,
341335
if (req->flags & REQ_F_REISSUE) {
342336
req->flags &= ~REQ_F_REISSUE;
343337
if (io_resubmit_prep(req))
344-
io_req_task_queue_reissue(req);
338+
return -EAGAIN;
345339
else
346340
io_req_task_queue_fail(req, final_ret);
347341
}

0 commit comments

Comments
 (0)