lkml.org 
[lkml]   [2021]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] io_uring: Delay io_wq creation to avoid unnecessary creation
Date
On 5/22/21 9:16 PM, Olivier Langlois wrote:
> Create the io_wq when we know that it is needed because the task
> will submit sqes.
>
> This eliminates a lot iou-mgr threads creation and memory allocation
> in those 2 scenarios:
>
> - A thread actually calling io_uring_enter() to submit sqes is not
> the same thread that has created the io_uring instance
> with io_uring_setup()
> - Every use cases where no sqe submission is performed (most SQPOLL setup)
>
> The benefits is less memory allocation and less context switching of
> io-mgr threads that will never have anything useful to do and the only cost
> is an extra condition evaluation in io_uring_enter().

1) there is no more io-mgr (5.13)

2) you move that from what is considered slow path into a hotter
place, that is not fine.

So I wouldn't care about it

>
> Signed-off-by: Olivier Langlois <olivier@trillion01.com>
> ---
> fs/io_uring.c | 27 +++++++++++++++++++--------
> 1 file changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 5f82954004f6..a01ae25d7c60 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -7881,6 +7881,18 @@ static struct io_wq *io_init_wq_offload(struct io_ring_ctx *ctx,
> return io_wq_create(concurrency, &data);
> }
>
> +static int io_uring_alloc_wq_offload(struct io_uring_task *tctx,
> + struct io_ring_ctx *ctx)
> +{
> + int ret = 0;
> +
> + tctx->io_wq = io_init_wq_offload(ctx);
> + if (IS_ERR(tctx->io_wq))

will be disastrous if you don't clear tctx->io_wq

> + ret = PTR_ERR(tctx->io_wq);
> +
> + return ret;
> +}
> +

--
Pavel Begunkov

\
 
 \ /
  Last update: 2021-05-23 10:27    [W:0.067 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site