Skip to content

Commit fdee946

Browse files
committed
io_uring: don't bounce block based -EAGAIN retry off task_work
These events happen inline from submission, so there's no need to bounce them through the original task. Just set them up for retry and issue retry directly instead of going over task_work. Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent eefdf30 commit fdee946

1 file changed

Lines changed: 6 additions & 20 deletions

File tree

fs/io_uring.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,22 +2295,6 @@ static bool io_resubmit_prep(struct io_kiocb *req, int error)
22952295
io_req_complete(req, ret);
22962296
return false;
22972297
}
2298-
2299-
static void io_rw_resubmit(struct callback_head *cb)
2300-
{
2301-
struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
2302-
struct io_ring_ctx *ctx = req->ctx;
2303-
int err;
2304-
2305-
err = io_sq_thread_acquire_mm(ctx, req);
2306-
2307-
if (io_resubmit_prep(req, err)) {
2308-
refcount_inc(&req->refs);
2309-
io_queue_async_work(req);
2310-
}
2311-
2312-
percpu_ref_put(&ctx->refs);
2313-
}
23142298
#endif
23152299

23162300
static bool io_rw_reissue(struct io_kiocb *req, long res)
@@ -2321,12 +2305,14 @@ static bool io_rw_reissue(struct io_kiocb *req, long res)
23212305
if ((res != -EAGAIN && res != -EOPNOTSUPP) || io_wq_current_is_worker())
23222306
return false;
23232307

2324-
init_task_work(&req->task_work, io_rw_resubmit);
2325-
percpu_ref_get(&req->ctx->refs);
2308+
ret = io_sq_thread_acquire_mm(req->ctx, req);
23262309

2327-
ret = io_req_task_work_add(req, &req->task_work, true);
2328-
if (!ret)
2310+
if (io_resubmit_prep(req, ret)) {
2311+
refcount_inc(&req->refs);
2312+
io_queue_async_work(req);
23292313
return true;
2314+
}
2315+
23302316
#endif
23312317
return false;
23322318
}

0 commit comments

Comments
 (0)