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]
Subject: Re: [PATCH 1/2] io_uring: micro optimization of __io_sq_thread() condition
Date: Fri, 2 Aug 2024 12:17:46 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <052ca60b5c49e7439e4b8bd33bfab4a09d36d3d6.1722374371.git.olivier@trillion01.com>

On 7/30/24 21:56, Olivier Langlois wrote:
> reverse the order of the element evaluation in an if statement.
> 
> for many users that are not using iopoll, the iopoll_list will always
> evaluate to false after having made a memory access whereas to_submit is
> very likely already loaded in a register.

doubt it'd make any difference, but it might be useful if sqpoll
submits requests often enough.

Reviewed-by: Pavel Begunkov <[email protected]>


> Signed-off-by: Olivier Langlois <[email protected]>
> ---
>   io_uring/sqpoll.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/io_uring/sqpoll.c b/io_uring/sqpoll.c
> index b3722e5275e7..cc4a25136030 100644
> --- a/io_uring/sqpoll.c
> +++ b/io_uring/sqpoll.c
> @@ -176,7 +176,7 @@ static int __io_sq_thread(struct io_ring_ctx *ctx, bool cap_entries)
>   	if (cap_entries && to_submit > IORING_SQPOLL_CAP_ENTRIES_VALUE)
>   		to_submit = IORING_SQPOLL_CAP_ENTRIES_VALUE;
>   
> -	if (!wq_list_empty(&ctx->iopoll_list) || to_submit) {
> +	if (to_submit || !wq_list_empty(&ctx->iopoll_list)) {
>   		const struct cred *creds = NULL;
>   
>   		if (ctx->sq_creds != current_cred())

-- 
Pavel Begunkov

  reply	other threads:[~2024-08-02 11:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30 21:19 [PATCH 0/2] io_uring: minor sqpoll code refactoring Olivier Langlois
2024-07-30 20:56 ` [PATCH 1/2] io_uring: micro optimization of __io_sq_thread() condition Olivier Langlois
2024-08-02 11:17   ` Pavel Begunkov [this message]
2024-07-30 21:10 ` [PATCH 2/2] io_uring: do the sqpoll napi busy poll outside the submission block Olivier Langlois
2024-08-02 11:14   ` Pavel Begunkov
2024-08-02 14:22     ` Olivier Langlois
2024-08-02 15:30       ` Pavel Begunkov
2024-08-02 13:11 ` (subset) [PATCH 0/2] io_uring: minor sqpoll code refactoring Jens Axboe

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] \
    /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