io_uring: don't free request to slab
PATCH v2 1/1 io_uring: don't free request to slab
It's not necessary to free the request back to slab when we fail to get sqe, just move it to state->free_list.
Signed-off-by Hao Xu <[email protected]>
--- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
@@ -6899,7 +6899,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr) } sqe =io_get_sqe (ctx);if (unlikely (!sqe)) { -kmem_cache_free (req_cachep, req); +list_add (&req->inflight_entry, &ctx->submit_state.free_list);break ; }/* will complete beyond this point, count as submitted */
Signature · 1 line
2.24.4
Quoted 2 lines · Hao Xu
It's not necessary to free the request back to slab when we fail to get sqe, just move it to
state->free_list.
Looks good, with that we have a consistent behaviour of retaining io_kiocb for all cases.
Reviewed-by Pavel Begunkov <[email protected]>
Quoted 19 lines
Signed-off-by Hao Xu <[email protected]>--- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/io_uring.c +1
-1@@ -6899,7 +6899,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr) } sqe =io_get_sqe (ctx);if (unlikely (!sqe)) { -kmem_cache_free (req_cachep, req); +list_add (&req->inflight_entry, &ctx->submit_state.free_list);break ; }/* will complete beyond this point, count as submitted */
Signature · 1 line
Pavel Begunkov
Quoted 2 lines · Hao Xu
It's not necessary to free the request back to slab when we fail to get sqe, just move it to
state->free_list.
Thanks, applied.
Signature · 1 line
Jens Axboe