[<prev] [next>] [day] [month] [year] [list]
Message-ID: <870d55a1-97a2-6fa2-24c1-3ac214b19bb4@gmail.com>
Date: Sun, 23 May 2021 09:26:51 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: Olivier Langlois <olivier@...llion01.com>,
Jens Axboe <axboe@...nel.dk>, io-uring@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] io_uring: Delay io_wq creation to avoid unnecessary
creation
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@...llion01.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
Powered by blists - more mailing lists