public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Olivier Langlois <[email protected]>,
	Jens Axboe <[email protected]>,
	[email protected], [email protected]
Subject: Re: [PATCH] io_uring: Delay io_wq creation to avoid unnecessary creation
Date: Sun, 23 May 2021 09:26:51 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

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

           reply	other threads:[~2021-05-23  8:27 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <[email protected]>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox