public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ionut Nechita (Sunlight Linux)" <sunlightlinux@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Frederic Weisbecker <frederic@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Anna-Maria Behnsen <anna-maria@linutronix.de>,
	Ionut Nechita <ionut_n2001@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] tick/nohz: Add fast-path tick stopping for idle isolated cores
Date: Tue,  6 Jan 2026 17:36:48 +0200	[thread overview]
Message-ID: <20260106153646.23280-4-sunlightlinux@gmail.com> (raw)
In-Reply-To: <20260106153646.23280-2-sunlightlinux@gmail.com>

From: Ionut Nechita <ionut_n2001@yahoo.com>

When a CPU is configured as nohz_full and is running the idle task with
no tick dependencies, we can skip expensive dependency checks and
immediately allow the tick to stop. This significantly reduces timer
interrupts on properly isolated cores.

The patch adds:
1. Prefetching of dependency structures for better cache locality
2. Fast-path optimization for idle isolated cores with no dependencies

This benefits real-time workloads and latency-sensitive applications
by minimizing timer interrupt overhead on isolated CPUs.

Benchmark results show isolated CPUs can achieve <500 LOC (Local timer)
interrupts with this optimization, compared to ~8K without it, with
best-case scenarios achieving <125 LOC interrupts on well-configured
systems.

Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
---
 kernel/time/tick-sched.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index b344fff613546..98391da485e2a 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -384,6 +384,29 @@ static bool can_stop_full_tick(int cpu, struct tick_sched *ts)
 {
 	lockdep_assert_irqs_disabled();
 
+	/*
+	 * Prefetch dependency structures for better cache locality
+	 */
+	prefetch(&tick_dep_mask);
+	prefetch(&ts->tick_dep_mask);
+	prefetch(&current->tick_dep_mask);
+	prefetch(&current->signal->tick_dep_mask);
+
+	/*
+	 * Fast path for idle isolated cores: if this is an isolated CPU
+	 * running the idle task with no dependencies, we can skip expensive
+	 * checks and immediately allow tick to stop. This significantly
+	 * reduces timer interrupts on properly isolated cores.
+	 */
+	if (tick_nohz_full_cpu(cpu) &&
+	    is_idle_task(current) &&
+	    !atomic_read(&tick_dep_mask) &&
+	    !atomic_read(&ts->tick_dep_mask) &&
+	    !atomic_read(&current->tick_dep_mask) &&
+	    !atomic_read(&current->signal->tick_dep_mask)) {
+		return true;
+	}
+
 	if (unlikely(!cpu_online(cpu)))
 		return false;
 
-- 
2.52.0


  reply	other threads:[~2026-01-06 15:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-06 15:36 [PATCH 0/1] tick/nohz: Optimize tick stopping for isolated cores Ionut Nechita (Sunlight Linux)
2026-01-06 15:36 ` Ionut Nechita (Sunlight Linux) [this message]
2026-01-13 10:02   ` [PATCH 1/1] tick/nohz: Add fast-path tick stopping for idle " Thomas Gleixner
2026-01-26 19:31     ` Ionut Nechita (Sunlight Linux)
2026-01-26 21:32       ` Thomas Gleixner
2026-01-27 13:40   ` Frederic Weisbecker
2026-01-28  7:26     ` Ionut Nechita (Sunlight Linux)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260106153646.23280-4-sunlightlinux@gmail.com \
    --to=sunlightlinux@gmail.com \
    --cc=anna-maria@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=ionut_n2001@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox