From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 91CD63A9D87 for ; Tue, 24 Feb 2026 16:37:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771951037; cv=none; b=QE1kF9LYNbAbkO3Ox/z5gl6BLQzzt5FopB7bgN8amuvkqm2fBviVybi0suIy/Fr2mThan/kjE5uP4SNj640A8/0LWZsYci8kzJD6CWQY0a2VC6IZDQ4a1TLtyu70z/rpfchiUPr5Dg9tPkObgMgdp4LBTw5SSvSI7e/CtHS2jKw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771951037; c=relaxed/simple; bh=ElmNqAJbHBNuSZSLp4xpGHQNAnzemlRBmIImR2xnErI=; h=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=hg1i90FYw12lMGSeFhT+8EXwABN/JSHEqDfZx/1k8O3MO+uAD/MDYCMXyS8ecvu9RazX/6Kxtg4/A0oQ+8y1To3lohwXm63OyjzBaB5nT0hDXWKzCYGmknzRDniGVhAgFxdCQLPqXEootQnfQ7e/jtC1C5S/ZcX3CvAVe8ZJxHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e/7oZRsP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e/7oZRsP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BADF7C116D0; Tue, 24 Feb 2026 16:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771951037; bh=ElmNqAJbHBNuSZSLp4xpGHQNAnzemlRBmIImR2xnErI=; h=Date:From:To:Cc:Subject:References:From; b=e/7oZRsPUcmtXNNkE0ZljwcArQKQ1ZCQaF7UvshiEhcRfqNIp6w96yGv5df7d0/Ks 7LW3Yu/FcACtX81RNkI9+9XnBjawfnsCzRwpaWuQO7i3s+ZvYjCFDxj8aiJZHPNg4l LgwzFTu4nYs/zOjdrQuwZ9j8ExQ9/xaTeB4xNY5mXjj3zNw7PrfdkhP3PIGX4fe9Ka CsMdsi9fLbGa313YL76Wg3AvXXV1e1sL85TAMfoPtjNhc8suD6j4sEAIcEbHrtR+ea wFvavRqzpnelLjVh5qrT5ELbfnutQiXRUBcmNDi1ZUeb5RP1BIP5Eno4cSa++oPGlB Z9GsNOz9qGsmQ== Date: Tue, 24 Feb 2026 17:37:14 +0100 Message-ID: <20260224163430.409352042@kernel.org> User-Agent: quilt/0.68 From: Thomas Gleixner To: LKML Cc: Anna-Maria Behnsen , John Stultz , Stephen Boyd , Daniel Lezcano , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , x86@kernel.org, Peter Zijlstra , Frederic Weisbecker , Eric Dumazet Subject: [patch 25/48] hrtimer: Evaluate timer expiry only once References: <20260224163022.795809588@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 No point in accessing the timer twice. Signed-off-by: Thomas Gleixner --- kernel/time/hrtimer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -810,10 +810,11 @@ static void hrtimer_reprogram(struct hrt { struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases); struct hrtimer_clock_base *base = timer->base; - ktime_t expires = ktime_sub(hrtimer_get_expires(timer), base->offset); + ktime_t expires = hrtimer_get_expires(timer); - WARN_ON_ONCE(hrtimer_get_expires(timer) < 0); + WARN_ON_ONCE(expires < 0); + expires = ktime_sub(expires, base->offset); /* * CLOCK_REALTIME timer might be requested with an absolute * expiry time which is less than base->offset. Set it to 0.