public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Hao Xu <[email protected]>, Jens Axboe <[email protected]>
Cc: [email protected], Joseph Qi <[email protected]>
Subject: Re: [PATCH] io_uring: don't iterate ctx list to update sq_thread_idle
Date: Mon, 15 Mar 2021 10:49:18 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 15/03/2021 08:56, Hao Xu wrote:
> sqd->sq_thread_idle can be updated by a simple max(), rather than
> iterating the whole ctx list to get the max one.

I left it as a more fool proof option. Do you have a performance issue
with it? E.g. dozens rings sharing a single SQPOLL and constantly adding
new ones.

> 
> Signed-off-by: Hao Xu <[email protected]>
> ---
>  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 a4bce17af506..17697b9890e3 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -7871,7 +7871,7 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx,
>  			ret = -ENXIO;
>  		} else {
>  			list_add(&ctx->sqd_list, &sqd->ctx_list);
> -			io_sqd_update_thread_idle(sqd);
> +			sqd->sq_thread_idle = max(sqd->sq_thread_idle, ctx->sq_thread_idle);
>  		}
>  		io_sq_thread_unpark(sqd);
>  
> 

-- 
Pavel Begunkov

  reply	other threads:[~2021-03-15 10:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15  8:56 [PATCH] io_uring: don't iterate ctx list to update sq_thread_idle Hao Xu
2021-03-15 10:49 ` Pavel Begunkov [this message]
2021-03-16  2:41   ` Hao Xu

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