io_uring: remove drain prealloc checks
Currently io_drain_req() has two steps. The first is fast path checking sequence numbers. The second is allocations, rechecking and actual queuing. Further simplify it by removing the first step. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/4d06e89ed07611993d7bf89182de2300858379bd.1746788718.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>pull/1250/head
parent
05b334110f
commit
e91e4f692f
|
|
@ -1674,17 +1674,6 @@ static __cold void io_drain_req(struct io_kiocb *req)
|
||||||
struct io_defer_entry *de;
|
struct io_defer_entry *de;
|
||||||
u32 seq = io_get_sequence(req);
|
u32 seq = io_get_sequence(req);
|
||||||
|
|
||||||
/* Still need defer if there is pending req in defer list. */
|
|
||||||
spin_lock(&ctx->completion_lock);
|
|
||||||
if (!req_need_defer(req, seq) && list_empty_careful(&ctx->defer_list)) {
|
|
||||||
spin_unlock(&ctx->completion_lock);
|
|
||||||
queue:
|
|
||||||
ctx->drain_active = false;
|
|
||||||
io_req_task_queue(req);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spin_unlock(&ctx->completion_lock);
|
|
||||||
|
|
||||||
io_prep_async_link(req);
|
io_prep_async_link(req);
|
||||||
de = kmalloc(sizeof(*de), GFP_KERNEL_ACCOUNT);
|
de = kmalloc(sizeof(*de), GFP_KERNEL_ACCOUNT);
|
||||||
if (!de) {
|
if (!de) {
|
||||||
|
|
@ -1696,7 +1685,9 @@ queue:
|
||||||
if (!req_need_defer(req, seq) && list_empty(&ctx->defer_list)) {
|
if (!req_need_defer(req, seq) && list_empty(&ctx->defer_list)) {
|
||||||
spin_unlock(&ctx->completion_lock);
|
spin_unlock(&ctx->completion_lock);
|
||||||
kfree(de);
|
kfree(de);
|
||||||
goto queue;
|
ctx->drain_active = false;
|
||||||
|
io_req_task_queue(req);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace_io_uring_defer(req);
|
trace_io_uring_defer(req);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue