From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from flow-a7-smtp.messagingengine.com (flow-a7-smtp.messagingengine.com [103.168.172.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70EC9392811 for ; Thu, 6 Aug 2026 07:33:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786001588; cv=none; b=dCoTcJAU2IYh4yk1Ogdpxxfep/Up+QSPraaCgT3D3TCvZibyUU2lW8YqK5daIpUGiF8AnM4tMzZvQdh97Jqu0LD45gOWgykky+83odpLG40hFtdyGf78+npck28474QPft/hvi0HUOi0AHWVy2Q32fJi1m7AwBNNqLc4Jlb0Pgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786001588; c=relaxed/simple; bh=5ykYl1rhbstT5kH52tkMWI2ILqiSDPHD7Ual8jbn404=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YuWiEvjgi3mIOrZn7LrjY9lqJSqysaNQT2WKWaJbT/ndCQkVyW/et2BJNkNQFmmIDNXRqbAvEw2Pvuf4nGepTn2ZS4k8JpdhoZXWg8qrBz9nBOdQnoW6mDRo05ltDqPt4bgYpQOmfmks0FPsNPL0kJP0P/YIERDz+NifgT2e4NY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=flapping.org; spf=pass smtp.mailfrom=flapping.org; dkim=pass (2048-bit key) header.d=flapping.org header.i=@flapping.org header.b=Y5PTEPSD; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=XOjYDtvp; arc=none smtp.client-ip=103.168.172.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=flapping.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flapping.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flapping.org header.i=@flapping.org header.b="Y5PTEPSD"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="XOjYDtvp" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailflow.phl.internal (Postfix) with ESMTP id 3DC92138022E; Thu, 6 Aug 2026 03:33:05 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 06 Aug 2026 03:33:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flapping.org; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to; s=fm1; t=1786001585; x=1786005185; bh=gwdTHGlSc1xyQJypHyaz1 U5oVZ/LQo2GXvh8r4kGCfU=; b=Y5PTEPSDJdcis57DFjPoNlBVFORNuPChxV77e PUa0NC7DZBKiSaIc4oKJXXo+KB/EQWK3v8xML8asqegRCG0UhzUXi4cvBEXd1Gk1 W2irs4QcDo0eGebZZlYCh/0Dn4yNgsn7MJDnW8v60nCS0l3p3FBnuOplxjyJw/7+ zLdJQlJTCH6R7sCz5YKRZSJeQuK0Ljpl/CitRwFE+FnS8FXDOKWEhTbhLAenmKty EKA8oTH+VLuJ9234mOyusRxtmAUOXAQdeJnPhYo6HrB2qw/jnFqGPk6msIwBLT1z vRBvOk/esRMQObq/FnRp0dhc5PWJ4bkqwgrM5qDmMz7COmlxg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1786001585; x=1786005185; bh=gwdTHGlSc1xyQJypHyaz1U5oVZ/LQo2GXvh 8r4kGCfU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MxA X-ME-Proxy: Feedback-ID: i51fe4b43:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Aug 2026 03:32:58 -0400 (EDT) From: FUJITA Tomonori To: a.hindborg@kernel.org, aliceryhl@google.com, arve@android.com, boqun@kernel.org, brauner@kernel.org, cmllamas@google.com, gary@garyguo.net, gregkh@linuxfoundation.org, ojeda@kernel.org, tkjos@android.com Cc: acourbot@nvidia.com, anna-maria@linutronix.de, bjorn3_gh@protonmail.com, dakr@kernel.org, daniel.almeida@collabora.com, frederic@kernel.org, jstultz@google.com, lossin@kernel.org, lyude@redhat.com, sboyd@kernel.org, tamird@kernel.org, tglx@kernel.org, tmgross@umich.edu, work@onurozkan.dev, rust-for-linux@vger.kernel.org, FUJITA Tomonori Subject: [PATCH v5 0/7] rust: use Delta instead of raw jiffies for timeouts and delays Date: Thu, 6 Aug 2026 16:32:34 +0900 Message-ID: <20260806073241.1024319-1-tomo@flapping.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: FUJITA Tomonori CondVar::wait_interruptible_timeout() and Queue::enqueue_delayed() use a raw jiffies count (a plain c_ulong alias with no type safety). Callers have to know on their own that the value meant jiffies and convert to/from it themselves, which is easy to get wrong (e.g. passing a millisecond value where a jiffies value is expected). Both APIs just take a span of time so, they can use the Delta type instead. This series makes Delta generic over its time unit with Nsec and Jiffy types, switches CondVar and Queue to use Delta instead of raw jiffies (updating binder's ioctl_freeze(), the only caller of wait_interruptible_timeout()), and then removes the now-unused Jiffies and Msecs type aliases. --- v5: - Fix as_millis_ceil() rounding near i64::MAX - Import Delta instead of using kernel::time::Delta twice v4: https://lore.kernel.org/rust-for-linux/20260722214951.72941-1-tomo@flapping.org/ - Make Delta generic over its time unit with Nsec and Jiffy types v3: https://lore.kernel.org/rust-for-linux/20260717042247.3634961-1-tomo@flapping.org/ - Add new Jiffies type and convert the APIs to take impl Into v2: https://lore.kernel.org/rust-for-linux/20260712235246.3069713-1-tomo@flapping.org/ - Fix potential overflow in from_jiffies() - Fix inflating bug in as_jiffies_ceil() - Add a patch to convert enqueue_delayed() - Add a patch to remove Jiffies/Msecs aliases v1: https://lore.kernel.org/rust-for-linux/20260704132558.2253275-1-tomo@aliasing.net/ --- FUJITA Tomonori (7): rust: time: make Delta generic over its time unit rust: time: add jiffies time unit for Delta rust: time: add Delta::as_millis_ceil() rust: time: add Delta::to_jiffies() for timeout conversion rust: workqueue: take a Delta for the enqueue delay rust: sync: condvar: use Delta for timeout and result rust: time: remove unused Jiffies/Msecs helpers drivers/android/binder/process.rs | 7 +- rust/kernel/sync/condvar.rs | 29 ++++-- rust/kernel/time.rs | 159 +++++++++++++++++++++++------- rust/kernel/workqueue.rs | 12 ++- 4 files changed, 154 insertions(+), 53 deletions(-) base-commit: dc01dfb37b34beeefcfe1c3055364d41a4070c7e -- 2.43.0