From nobody Mon Nov 25 14:49:06 2024 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 B8D8A217645; Fri, 25 Oct 2024 18:01:32 +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=1729879294; cv=none; b=NfvGiL2QoW5NUBuWWtlph8PwpwWEHQwIsM2mqPD1z7qnuIZP+mi8u67NB84uEOs1YhTjNsZD1f06xmfFBfS/VNitVJf1rwRX7Y9UD8uGOsFrssfhFZ5MGq9jAJ/KMSgEhMNja2riWcnCSbI/AKAsTT9GCS68eXo+ZwPkkbHsniA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729879294; c=relaxed/simple; bh=09rtN23f/2fqGEVqw5BDo6aBndOaeqSyLy6vxabVDRo=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=lzQ02pCS/XXHDThgnYuQQvrELgDi57hyEP5Am9xHs6Yk9cJFN8d9U9d9PH3WKQQc+fDvEj23VktfXiO+YhnR5DZMleRSX7p6ZFL1N+XqOaxUOna0c4gT4NTuEN0lJkrQLhsQRY2O0Ny8/xeuhkKF+VHWoNrmrgNXKJ+AG4L7RtE= 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=vwRywgr0; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fIyWrO+M; 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="vwRywgr0"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fIyWrO+M" Date: Fri, 25 Oct 2024 18:01:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1729879291; 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=sygGQNoZWnNpdRcx9DihtuqwyWyLHZkIhdV98RSYqeg=; b=vwRywgr0e75SpidkRKyiXwk7sZo8YFfdNUjfRpT7AlaIe+BS45Ail57I9xtysEK0tH/Jty mZ113eRsAnors3AI5yzDJ9tfco785M0patcFEEb1N1/FwiEiL4d2Bacmkz8TO9h1N0+km/ xCg3fPCYOQv44dLULDetalAk6a9b64UA+gSXxHXwF6lQpM5xawp2IlNqI4hBTAr12loZqI KmnSEbmOXGTHbhkIQxXk+fCmMw4/5/2kwXCh+uCjK8D6w4Hb4hjvf3N9MexjbuWmtERq8u abSXfQqHapZj5IpP/LpNj1ENcLHr7mTkvW0Vi9ss6ykVH/yKKK77ncjV4TSZpA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1729879291; 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=sygGQNoZWnNpdRcx9DihtuqwyWyLHZkIhdV98RSYqeg=; b=fIyWrO+MyLf8MtmA/qlYpRNbPMJvIHVqPYgS6tG4CE52biayb1Rcm+3AMgmH+WhEOWf0cd N9GGr0zYdcTZnJCQ== 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] timekeeping: Read NTP tick length only once Cc: Thomas Gleixner , "Anna-Maria Behnsen" , John Stultz , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3C20241009-devel-anna-maria-b4-timers-ptp-timekeepin?= =?utf-8?q?g-v2-1-554456a44a15=40linutronix=2Ede=3E?= References: =?utf-8?q?=3C20241009-devel-anna-maria-b4-timers-ptp-timekeeping?= =?utf-8?q?-v2-1-554456a44a15=40linutronix=2Ede=3E?= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <172987929055.1442.14883159884487157363.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: 14f1e3b3dfc7fc8b61fcb79f956f05625af6f049 Gitweb: https://git.kernel.org/tip/14f1e3b3dfc7fc8b61fcb79f956f05625= af6f049 Author: Thomas Gleixner AuthorDate: Wed, 09 Oct 2024 10:28:54 +02:00 Committer: Thomas Gleixner CommitterDate: Fri, 25 Oct 2024 19:49:12 +02:00 timekeeping: Read NTP tick length only once No point in reading it a second time when the comparison fails. Signed-off-by: Thomas Gleixner Signed-off-by: Anna-Maria Behnsen Signed-off-by: Thomas Gleixner Acked-by: John Stultz Link: https://lore.kernel.org/all/20241009-devel-anna-maria-b4-timers-ptp-t= imekeeping-v2-1-554456a44a15@linutronix.de --- kernel/time/timekeeping.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 1427c58..2bc3542 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -2161,16 +2161,17 @@ static __always_inline void timekeeping_apply_adjus= tment(struct timekeeper *tk, */ static void timekeeping_adjust(struct timekeeper *tk, s64 offset) { + u64 ntp_tl =3D ntp_tick_length(); u32 mult; =20 /* * Determine the multiplier from the current NTP tick length. * Avoid expensive division when the tick length doesn't change. */ - if (likely(tk->ntp_tick =3D=3D ntp_tick_length())) { + if (likely(tk->ntp_tick =3D=3D ntp_tl)) { mult =3D tk->tkr_mono.mult - tk->ntp_err_mult; } else { - tk->ntp_tick =3D ntp_tick_length(); + tk->ntp_tick =3D ntp_tl; mult =3D div64_u64((tk->ntp_tick >> tk->ntp_error_shift) - tk->xtime_remainder, tk->cycle_interval); }