* Re: [PATCH] io_uring: Delay io_wq creation to avoid unnecessary creation
[not found] <[email protected]>
@ 2021-05-23 8:26 ` Pavel Begunkov
0 siblings, 0 replies; only message in thread
From: Pavel Begunkov @ 2021-05-23 8:26 UTC (permalink / raw)
To: Olivier Langlois, Jens Axboe, io-uring, linux-kernel
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 <[email protected]>
> ---
> 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-23 8:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <[email protected]>
2021-05-23 8:26 ` [PATCH] io_uring: Delay io_wq creation to avoid unnecessary creation Pavel Begunkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox