From: FUJITA Tomonori <tomo@flapping.org>
To: boqun@kernel.org
Cc: tomo@flapping.org, aliceryhl@google.com, arve@android.com,
brauner@kernel.org, cmllamas@google.com, gary@garyguo.net,
gregkh@linuxfoundation.org, ojeda@kernel.org, tkjos@android.com,
a.hindborg@kernel.org, acourbot@nvidia.com,
bjorn3_gh@protonmail.com, dakr@kernel.org,
daniel.almeida@collabora.com, lossin@kernel.org,
lyude@redhat.com, tamird@kernel.org, tmgross@umich.edu,
work@onurozkan.dev, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, fujita.tomonori@gmail.com
Subject: Re: [PATCH v9] rust: sync: condvar: use Delta<Jiffy> for timeout and result
Date: Tue, 03 Nov 2026 09:09:41 +0900 (JST) [thread overview]
Message-ID: <20261103.090941.728506274497185931.tomo@flapping.org> (raw)
In-Reply-To: <auixgbeSSfBWwVS9@tardis.local>
On Mon, 2 Nov 2026 07:51:29 -0800
Boqun Feng <boqun@kernel.org> wrote:
> On Mon, Nov 02, 2026 at 12:59:34PM +0900, FUJITA Tomonori wrote:
>> From: FUJITA Tomonori <fujita.tomonori@gmail.com>
>>
>> wait_interruptible_timeout() takes the timeout as a raw Jiffies, and
>> CondVarTimeoutResult reports the remaining time as a raw Jiffies. The
>> type does not show the unit.
>>
>> Switch the parameter and the result fields to Delta<Jiffy>.
>>
>> Delta<Jiffy> is signed, but schedule_timeout() prints an error and a
>> stack dump for a negative timeout. Clamp a negative timeout to zero, so
>> it means an immediate timeout.
>>
>> Update the only user, binder. It now converts the freeze timeout with
>> Delta::to_jiffies_timeout() instead of msecs_to_jiffies(). Both round
>> up, so a short timeout does not become zero. They differ only for a
>> very long timeout. msecs_to_jiffies() returns MAX_JIFFY_OFFSET for
>> 2^31 ms (about 24.9 days) or more, which means an infinite
>> timeout. to_jiffies_timeout() has no such special case. It converts
>> such a value to the matching number of jiffies, so the wait is long
>> but finite.
>>
>> Reviewed-by: Gary Guo <gary@garyguo.net>
>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
>
> Thanks. Alice, any concern regarding the change in binder?
>
> I have some naming suggestion, please see below:
[...]
>> @@ -248,11 +261,11 @@ pub enum CondVarTimeoutResult {
>> /// Somebody woke us up.
>> Woken {
>> /// Remaining sleep duration.
>> - jiffies: Jiffies,
>> + jiffies: Delta<Jiffy>,
>> },
>> /// A signal occurred.
>> Signal {
>> /// Remaining sleep duration.
>> - jiffies: Jiffies,
>> + jiffies: Delta<Jiffy>,
>
> Similar for these two: s/jiffies/remainder
>
> Thoughts?
Sounds good to me. Now that the type shows the unit, the names should
say what the value means. I'll rename all of them in v10.
I'll wait a few days for Alice's comment on the binder change before
sending v10.
prev parent reply other threads:[~2026-11-03 0:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 3:59 FUJITA Tomonori
2026-11-02 15:51 ` Boqun Feng
2026-11-03 0:09 ` FUJITA Tomonori [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 \
--in-reply-to=20261103.090941.728506274497185931.tomo@flapping.org \
--to=tomo@flapping.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=arve@android.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=brauner@kernel.org \
--cc=cmllamas@google.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.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=tkjos@android.com \
--cc=tmgross@umich.edu \
--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®