public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jeff Moyer <[email protected]>
To: Dmitry Antipov <[email protected]>
Cc: Jens Axboe <[email protected]>,
	 Pavel Begunkov <[email protected]>,
	[email protected]
Subject: Re: [PATCH] io_uring: do not assume that ktime_t is equal to nanoseconds
Date: Thu, 13 Feb 2025 14:13:59 -0500	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]> (Dmitry Antipov's message of "Thu, 13 Feb 2025 18:44:52 +0300")

Dmitry Antipov <[email protected]> writes:

> In 'io_cqring_schedule_timeout()', do not assume that 'ktime_t' is
> equal to nanoseconds and prefer 'ktime_add()' over 'ktime_add_ns()'
> to sum two 'ktime_t' values. Compile tested only.
>
> Fixes: 1100c4a2656d ("io_uring: add support for batch wait timeout")
> Signed-off-by: Dmitry Antipov <[email protected]>
> ---
>  io_uring/io_uring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index ceacf6230e34..7f2500aca95c 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -2434,7 +2434,7 @@ static int io_cqring_schedule_timeout(struct io_wait_queue *iowq,
>  	ktime_t timeout;
>  
>  	if (iowq->min_timeout) {
> -		timeout = ktime_add_ns(iowq->min_timeout, start_time);
> +		timeout = ktime_add(iowq->min_timeout, start_time);

I don't think this solves the issue stated in the commit message.  Look
at where the min_timeout comes from, in io_get_ext_arg:

	ext_arg->min_time = READ_ONCE(w->min_wait_usec) * NSEC_PER_USEC;

Perhaps that should be:

	ext_arg->min_time = us_to_ktime(READ_ONCE(w->min_wait_usec));

I also don't know whether this warrants a fixes tag, given it doesn't
change any behavior.

Cheers,
Jeff


      parent reply	other threads:[~2025-02-13 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13 15:44 [PATCH] io_uring: do not assume that ktime_t is equal to nanoseconds Dmitry Antipov
2025-02-13 18:13 ` Jens Axboe
2025-02-13 19:13 ` Jeff Moyer [this message]

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