public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@kernel.org>
To: "Ionut Nechita (Sunlight Linux)" <sunlightlinux@gmail.com>,
	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: Re: [PATCH 1/1] tick/nohz: Add fast-path tick stopping for idle isolated cores
Date: Tue, 13 Jan 2026 11:02:19 +0100	[thread overview]
Message-ID: <873449g79w.ffs@tglx> (raw)
In-Reply-To: <20260106153646.23280-4-sunlightlinux@gmail.com>

On Tue, Jan 06 2026 at 17:36, Ionut Nechita wrote:
> 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

s/we can/it is possible to/

> immediately allow the tick to stop. This significantly reduces timer
> interrupts on properly isolated cores.
>
> The patch adds:

"The patch adds" is a pointless filler phrase. See

     Documentation/process/

> +	/*
> +	 * 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);

These are really not required.

> +	/*
> +	 * 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;

How is that different from the existing checks for the various
dependency masks, except for the added nohz_full_cpu() and
is_idle_task() conditions?

I can see that not going through the per bit checks is faster, but I
really do not see how this reduces the timer interrupts by an order of
magnitude. At least not without a proper explanation why this matters
and how this optimization is causing this improvement.

Also why is this restricted to tick_nohz_full CPUs and to the idle task?

You can avoid the per bit evaluation way simpler, which improves the
evaluation independent of context. See uncompiled patch below.

Thanks,

        tglx
---
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -344,6 +344,9 @@ static bool check_tick_dependency(atomic
 {
 	int val = atomic_read(dep);
 
+	if (likely(!tracepoint_enabled(tick_stop)))
+		return !val;
+
 	if (val & TICK_DEP_MASK_POSIX_TIMER) {
 		trace_tick_stop(0, TICK_DEP_MASK_POSIX_TIMER);
 		return true;





  reply	other threads:[~2026-01-13 10:02 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 ` [PATCH 1/1] tick/nohz: Add fast-path tick stopping for idle " Ionut Nechita (Sunlight Linux)
2026-01-13 10:02   ` Thomas Gleixner [this message]
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=873449g79w.ffs@tglx \
    --to=tglx@kernel.org \
    --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=sunlightlinux@gmail.com \
    /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