Re: [PATCH] io_uring: don't free request to slab

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/25/21 12:40 PM, Hao Xu wrote:
> It's not neccessary to free the request back to slab when we fail to
> get sqe, just update state->free_reqs pointer.

It's a bit hackish because depends on the request being drawn
from the array in a particular way. How about returning it
into state->free_list. That thing is as cold as it can get,
only buggy apps can hit it. 


> Signed-off-by: Hao Xu <haoxu@xxxxxxxxxxxxxxxxx>
> ---
>  fs/io_uring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 74b606990d7e..ce66a9ce2b43 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -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);
> +			ctx->submit_state.free_reqs++;
>  			break;
>  		}
>  		/* will complete beyond this point, count as submitted */
> 

-- 
Pavel Begunkov



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux