mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: FUJITA Tomonori <tomo@flapping.org>
To: dakr@kernel.org, boqun@kernel.org
Cc: gary@garyguo.net, aliceryhl@google.com, lyude@redhat.com,
	daniel.almeida@collabora.com, work@onurozkan.dev,
	ojeda@kernel.org, bjorn3_gh@protonmail.com, lossin@kernel.org,
	a.hindborg@kernel.org, tmgross@umich.edu, tamird@kernel.org,
	acourbot@nvidia.com, viro@zeniv.linux.org.uk, brauner@kernel.org,
	jack@suse.cz, linux-kernel@vger.kernel.org,
	rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 1/5] rust: task: add safe schedule_timeout() wrapper
Date: Thu, 05 Nov 2026 13:20:31 +0900 (JST)	[thread overview]
Message-ID: <20261105.132031.1626373229852235546.tomo@flapping.org> (raw)
In-Reply-To: <20261105005951.756157-2-dakr@kernel.org>

On Thu,  5 Nov 2026 01:59:38 +0100
Danilo Krummrich <dakr@kernel.org> wrote:

> Add a safe wrapper around schedule_timeout() that takes and returns
> Jiffies, handling the c_long conversion internally.
> 
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>

[...]

> +/// Sleeps for the given timeout in [`Jiffies`], or until woken.
> +///
> +/// Returns the remaining time in [`Jiffies`], or zero if the timeout expired.  The task state
> +/// should be set before calling this.
> +///
> +/// Timeouts at or above [`MAX_SCHEDULE_TIMEOUT`] mean an indefinite wait. In that case, the return
> +/// value is `MAX_SCHEDULE_TIMEOUT` as [`Jiffies`].
> +#[inline]
> +pub fn schedule_timeout(timeout: Jiffies) -> Jiffies {
> +    let timeout = timeout.try_into().unwrap_or(MAX_SCHEDULE_TIMEOUT);

The Jiffies alias will be removed, so could you use Delta<Jiffy> here
instead? I think the code would be almost the same as in my patch that
converts condvar [1].

This series conflicts with that patch. Boqun, how would you like to
merge them?

[1] https://lore.kernel.org/rust-for-linux/20261104235929.1282640-1-tomo@flapping.org/

  reply	other threads:[~2026-11-05  4:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  0:59 [PATCH v2 0/5] rust: sync: add WaitQueue infrastructure Danilo Krummrich
2026-11-05  0:59 ` [PATCH v2 1/5] rust: task: add safe schedule_timeout() wrapper Danilo Krummrich
2026-11-05  4:20   ` FUJITA Tomonori [this message]
2026-11-05  0:59 ` [PATCH v2 2/5] rust: sync: add WaitQueue infrastructure Danilo Krummrich
2026-11-05  0:59 ` [PATCH v2 3/5] rust: sync: convert CondVar and PollCondVar to use WaitQueue Danilo Krummrich
2026-11-05  0:59 ` [PATCH v2 4/5] rust: sync: condvar: use task::schedule_timeout() Danilo Krummrich
2026-11-05  0:59 ` [PATCH v2 5/5] rust: sync: condvar: add non-exclusive freezable waiting Danilo Krummrich

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 \
    --in-reply-to=20261105.132031.1626373229852235546.tomo@flapping.org \
    --to=tomo@flapping.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=brauner@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=viro@zeniv.linux.org.uk \
    --cc=work@onurozkan.dev \
    /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

all inboxes | Powered by JetHome®