mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Boqun Feng <boqun@kernel.org>
Cc: Alice Ryhl <aliceryhl@google.com>,
	FUJITA Tomonori <tomo@flapping.org>,
	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 <fujita.tomonori@gmail.com>
Subject: Re: [PATCH v9] rust: sync: condvar: use Delta<Jiffy> for timeout and result
Date: Wed,  4 Nov 2026 13:03:41 +0000	[thread overview]
Message-ID: <20261104130342.261593-1-aliceryhl@google.com> (raw)
In-Reply-To: <auixgbeSSfBWwVS9@tardis.local>

On Mon, Nov 02, 2026 at 07:51:29AM -0800, Boqun Feng wrote:
> On Mon, Nov 02, 2026 at 12:59:34PM +0900, FUJITA Tomonori wrote:
> > 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:
> 
> > ---
> >  drivers/android/binder/process.rs |  7 ++++---
> >  rust/kernel/sync/condvar.rs       | 31 ++++++++++++++++++++++---------
> >  2 files changed, 26 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs
> > index 1f4cb43f1de6..edde0ea35687 100644
> > --- a/drivers/android/binder/process.rs
> > +++ b/drivers/android/binder/process.rs
> > @@ -1552,8 +1553,8 @@ pub(crate) fn ioctl_freeze(&self, info: &BinderFreezeInfo) -> Result {
> >          inner.is_frozen = IsFrozen::InProgress;
> >  
> >          if info.timeout_ms > 0 {
> > -            let mut jiffies = kernel::time::msecs_to_jiffies(info.timeout_ms);
> > -            while jiffies > 0 {
> > +            let mut jiffies = Delta::from_millis(info.timeout_ms.into()).to_jiffies_timeout();
> 
> I would rename this variable to `timeout`, i.e.
> 
> 	let timeout = Delta::from_millis(info.timeout_ms.into()).to_jiffies_timeout();
> 
> Thoughts?

No concerns from me; the binder change and your naming suggestions look
good to me.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

Alice

      parent reply	other threads:[~2026-11-04 13:03 UTC|newest]

Thread overview: 4+ 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
2026-11-04 13:03   ` Alice Ryhl [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=20261104130342.261593-1-aliceryhl@google.com \
    --to=aliceryhl@google.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.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=tomo@flapping.org \
    --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®