From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from flow-b1-smtp.messagingengine.com (flow-b1-smtp.messagingengine.com [202.12.124.136]) (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 9F8694399C2 for ; Wed, 22 Jul 2026 21:51:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784757078; cv=none; b=BxSfuFwoz7m1svA5836J/zyMosv14tkqtsfSUfiHROTreW3JiEMTLE0aUUebH7G7Y+sMiUKoAUqv2wuHMFzWBSLwKSaG/dp8+uhknae7Vj6RqHmdxse8znAhmG1+jJLK5U9SconTTSSs7/kJWRyGCE4IS5u6cAPIebd8jWixZJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784757078; c=relaxed/simple; bh=O0I1e2Bk0Tw8zf1/LmStHjNmkXeKz5UGIUUowbtzoFE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AVz96yIqjCmkFhZz10ZUy2HexfOir0G87EkHkSHt2kCbEK1UDA0fRJBHn+0/XdbmB1iki/qGVHeOL8PQAzdKa87QuBTWTqkjD6oP+aC//xA1yG984AdTfpYWTjkiFEJ/OhBIk+g0YsJUfe11ffSFRUbt8JzUrVVf4VQFQjyvt3M= 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=cOSN8s+v; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=DbCLrt8J; arc=none smtp.client-ip=202.12.124.136 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="cOSN8s+v"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DbCLrt8J" Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailflow.stl.internal (Postfix) with ESMTP id BC95613007DD; Wed, 22 Jul 2026 17:51:13 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Wed, 22 Jul 2026 17:51:14 -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=1784757073; x=1784760673; bh=QYmF4fH4M3RBOy2wazKiE Lyy/CXsQs07nJ7J1Jqn1nY=; b=cOSN8s+vYLT74q2/i3tKMIHyCeyWru3cAdgnR R52fl3GU9kDrXE9uuc3NBfnK2e4IJ9p7MnqkXFvlfN/rxHL/gUIAYWnFqaL/IOSy 6OmDKvzzeZYGYx4PUySxbRid3op+CgqV+kJd1YtFj/z1ZjM9ZmGcVxXJJzeW8IQv 77XR8Z5w4x5RmBHFou1hTo60FbtVA6gnQSLyqWzIpLnHUCH+2Kr1FVBAckH5gfvO p3cMkqnHanSKdnEusfKyvP/b/D8lnH/rmoRUa8vpDIGPR/+gQ7C/WIDrBSsAzaFw aykkEfyKcPQDj/SYvbhtN4dG4O9Puj4cM3VsIgh5Bh3AITxTQ== 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=fm2; t= 1784757073; x=1784760673; bh=QYmF4fH4M3RBOy2wazKiELyy/CXsQs07nJ7 J1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1//fS8AOCQ X-ME-Proxy: Feedback-ID: i51fe4b43:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Jul 2026 17:51:07 -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 v4 0/7] rust: use Delta instead of raw jiffies for timeouts and delays Date: Thu, 23 Jul 2026 06:49:44 +0900 Message-ID: <20260722214951.72941-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. --- v4: - 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 | 6 +- rust/kernel/sync/condvar.rs | 29 ++++-- rust/kernel/time.rs | 156 ++++++++++++++++++++++-------- rust/kernel/workqueue.rs | 12 ++- 4 files changed, 150 insertions(+), 53 deletions(-) base-commit: 7059bdf4f04a3e14f4fafb3ac35fdca913e3e21a -- 2.43.0