From nobody Sun Jun 14 07:39:26 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 EE110421EF6; Fri, 1 May 2026 19:40:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777664439; cv=none; b=PgcHiHi8tTFvcGWhiimAzpkqS4DtOY3VZRP2iwNS4mvmovv9GAkNImqe0ZoMQMNhk15Sl2pK25xcKXzxrTkiKPXG2/xRvsm3eywMkSnnSqt9nwaEglZ8Q/rCpvaelULiG47EW3eOxc4mIyKCur74TPUTocIppIdqDxMk6Z6mkbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777664439; c=relaxed/simple; bh=ZMH0FEay3ysUbntbURdO0MWzItnNiKR/2Fnu73xaojg=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=l+XVI+JTCPrb9y1ZbPHNkjVec6gEQyjn89RhITR8uvULvLswINwHwHp7zYAIiXimig35rtkSLxNYAty7ixszGydzDxjXGejqoC9bcpPhnwEEnzPbPGkgJEOYgz8akJYhNfuSfCg/y6t7gxo4EmjPvVs1CY7u3VBsqCHd5ucRWFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=msclvIF6; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=usHVbKOd; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="msclvIF6"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="usHVbKOd" Date: Fri, 01 May 2026 19:40:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777664435; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FadhfM9jIbm9GnJM5CWVRL6tBugAhSgEkUjlYBORnC4=; b=msclvIF6faLO/am8CTk/bAKA1YMTFxjdAdJ5497/SP5KuPgs9FuCirXYTEFXKOW5EQUsoU tAX1VhBy83dtT+S5LcGIp2O54ca+LpFLCpmwiZhw045EecIVE/WDb3TWpE31j7oNhMptMU D7GnxB2Kwau3Bdn1F/XsRawR7kU5PjaWVnRv7CkCl3gemgxWcxyQcZ9Dj+yjsgVWEsl0Ys 734qfRpVyEBhR6KTS4EGUHYo6so714hjokUazP092jkagSzPVnx6KbPzFLFR3nTIyit3Ob Te5eJYll/2grd5K+SfToPaY7IpumAqiL12pFs23LZXzqBdEJXpnTSyg8ZR3Tig== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777664435; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FadhfM9jIbm9GnJM5CWVRL6tBugAhSgEkUjlYBORnC4=; b=usHVbKOd3bqMqx+gXXWfvYQEuEI5dpTIb7nXQulV5G8OpxPiZDcE4mgs5JAvV/k3VDgzpv 777iHE2jgLPCrzBg== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] hrtimer: Use hrtimer_start_expires_user() for hrtimer sleepers Cc: Thomas Gleixner , Calvin Owens , Frederic Weisbecker , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260408114952.062400833@kernel.org> References: <20260408114952.062400833@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177766443397.3521451.16738866773431708896.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/core branch of tip: Commit-ID: b40c927345a91e687eac4c3c5ca03a99643cd0c4 Gitweb: https://git.kernel.org/tip/b40c927345a91e687eac4c3c5ca03a996= 43cd0c4 Author: Thomas Gleixner AuthorDate: Wed, 08 Apr 2026 13:53:52 +02:00 Committer: Thomas Gleixner CommitterDate: Fri, 01 May 2026 21:36:11 +02:00 hrtimer: Use hrtimer_start_expires_user() for hrtimer sleepers Most hrtimer sleepers are user controlled and user space can hand arbitrary expiry values in as long as they are valid timespecs. If the expiry value is in the past then this requires a full loop through reprogramming the clock event device, taking the hrtimer interrupt, waking the task and reprogram again. Use hrtimer_start_expires_user() which avoids the full round trip by checking the timer for expiry on enqueue. Signed-off-by: Thomas Gleixner Tested-by: Calvin Owens Reviewed-by: Frederic Weisbecker Acked-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260408114952.062400833@kernel.org --- kernel/time/hrtimer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 79aaac4..8cfc7aa 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -2315,7 +2315,11 @@ void hrtimer_sleeper_start_expires(struct hrtimer_sl= eeper *sl, enum hrtimer_mode if (IS_ENABLED(CONFIG_PREEMPT_RT) && sl->timer.is_hard) mode |=3D HRTIMER_MODE_HARD; =20 - hrtimer_start_expires(&sl->timer, mode); + /* If already expired, clear the task pointer and set current state to ru= nning */ + if (!hrtimer_start_expires_user(&sl->timer, mode)) { + sl->task =3D NULL; + __set_current_state(TASK_RUNNING); + } } EXPORT_SYMBOL_GPL(hrtimer_sleeper_start_expires); =20