From nobody Sat Apr 18 09:11:03 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 72C8C47DD49; Sat, 28 Feb 2026 15:36:35 +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=1772293003; cv=none; b=M0qmHsofnfKHdCt/oxusD5CeIdJMTRXxDMosJAaGyNxUKRaXkcKgtq4flMVWawoEjFsZeBq3aapxHA95gYwBJvLm2HQ9h7Nt/v55lPUg2zUXjZV/nq5WMbsQ+MK+1y3MswylumgPw0E1HIDwuLwOmMSTnncIciK0XCU0GFoiHgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772293003; c=relaxed/simple; bh=0rdlmNlEALuHyq+zBF88oenWj//pw+AV3h5cqO4w2/o=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=NKDGeO2IpeIMP0AGQrEYSIzCRpKxPkSrpVXdDkfsdoAqYeeyGBHI9i4/xrMaC78ntqLc8NEo4qCe7Uxl1/fMR7YJRo/iY1lyZk1j++hwDReSvv9ZOPv9pj/zjajWmjhFn4ls0AjxVDNyQk3QGK18Nr4u0AgK6vPJNOvQb086PX0= 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=L5yBPHHk; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=BmNFhJNe; 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="L5yBPHHk"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BmNFhJNe" Date: Sat, 28 Feb 2026 15:36:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1772292994; 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=eS0i8AcuaK1+JqJ4H/N4yr1ntIeVielAhgtcieQFrUc=; b=L5yBPHHk/SvcfRU7Xdk+XIRIgWPwl3RKX6cWVzT563A4RFKBkbtxs6rAKtwdluSGlxR2X7 8/3ZME/ksLJKx5M1fWyLyDkrUaxjy6WvilOShDzHzB4hD7ybIm93SOhePGDASXrYeuDJfR 8bWltFp+Rh0lSQGELep9fo2V79R2mvPn7OEE+viEzHmb6Qjj1a/Y0WNhvTVGCM2QOU93y+ iQdo/KWy+Yp4PuMi/5E2VY/xus5hsgzEMD/fu2TomPpmtU2jfK2dG4bu4lZNan5lkhpq2j BELjnW5321zNpKiKLx0ucy7ad3Z3vot1kJUzvHcb5I/811QCBuCM3MA0p4AO0Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1772292994; 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=eS0i8AcuaK1+JqJ4H/N4yr1ntIeVielAhgtcieQFrUc=; b=BmNFhJNeQ1xbQbpOBBIuBFsVs+Rf/kUSSZSsnfJkK7F3zj5D3V2oEjC2/zqk6wfLTjnBFD ofzKc/b/TqCdKPBA== 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: sched/hrtick] hrtimer: Use NOHZ information for locality Cc: Thomas Gleixner , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260224163430.673473029@kernel.org> References: <20260224163430.673473029@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177229299289.1647592.10986848186850662678.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 sched/hrtick branch of tip: Commit-ID: c939191457fead7bce2f991fe5bf39d4d5dde90f Gitweb: https://git.kernel.org/tip/c939191457fead7bce2f991fe5bf39d4d= 5dde90f Author: Thomas Gleixner AuthorDate: Tue, 24 Feb 2026 17:37:33 +01:00 Committer: Peter Zijlstra CommitterDate: Fri, 27 Feb 2026 16:40:11 +01:00 hrtimer: Use NOHZ information for locality The decision to keep a timer which is associated to the local CPU on that CPU does not take NOHZ information into account. As a result there are a lot of hrtimer base switch invocations which end up not switching the base and stay on the local CPU. That's just work for nothing and can be further improved. If the local CPU is part of the NOISE housekeeping mask, then check: 1) Whether the local CPU has the tick running, which means it is either not idle or already expecting a timer soon. 2) Whether the tick is stopped and need_resched() is set, which means the CPU is about to exit idle. This reduces the amount of hrtimer base switch attempts, which end up on the local CPU anyway, significantly and prepares for further optimizations. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260224163430.673473029@kernel.org --- kernel/time/hrtimer.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index b87995f..4caf2df 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1231,7 +1231,18 @@ static __always_inline bool hrtimer_prefer_local(boo= l is_local, bool is_first, b */ if (!is_local) return false; - return is_first || is_pinned; + if (is_first || is_pinned) + return true; + + /* Honour the NOHZ full restrictions */ + if (!housekeeping_cpu(smp_processor_id(), HK_TYPE_KERNEL_NOISE)) + return false; + + /* + * If the tick is not stopped or need_resched() is set, then + * there is no point in moving the timer somewhere else. + */ + return !tick_nohz_tick_stopped() || need_resched(); } return is_local; }