mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Snyder <josh@code406.com>
To: Anna-Maria Behnsen <anna-maria@linutronix.de>,
	 Frederic Weisbecker <frederic@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	 Thomas Gleixner <tglx@kernel.org>,
	 "Ionut Nechita (Sunlight Linux)" <sunlightlinux@gmail.com>
Cc: linux-kernel@vger.kernel.org, Josh Snyder <josh@code406.com>
Subject: [PATCH] tick/nohz: fix inverted return value in check_tick_dependency() fast path
Date: Thu, 02 Apr 2026 16:23:38 -0700	[thread overview]
Message-ID: <20260402-fix-idle-tick2-v1-1-eecb589649d3@code406.com> (raw)

Commit 56534673cea7f ("tick/nohz: Optimize check_tick_dependency() with
early return") added a fast path that returns !val when the tick_stop
tracepoint is disabled.  This is inverted: the slow path returns true
when a dependency IS found (val != 0), but !val returns true when val
is zero (no dependency).  The result is that can_stop_full_tick() sees
"dependency found" when there are none, and the tick never stops on
nohz_full CPUs.

Fix by returning val instead of !val, matching the slow-path semantics.

Fixes: 56534673cea7f ("tick/nohz: Optimize check_tick_dependency() with early return")
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Josh Snyder <josh@code406.com>
---
 kernel/time/tick-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index f7907fadd63f2..4324f3838ab0d 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -345,7 +345,7 @@ static bool check_tick_dependency(atomic_t *dep)
 	int val = atomic_read(dep);
 
 	if (likely(!tracepoint_enabled(tick_stop)))
-		return !val;
+		return val;
 
 	if (val & TICK_DEP_MASK_POSIX_TIMER) {
 		trace_tick_stop(0, TICK_DEP_MASK_POSIX_TIMER);

---
base-commit: 4f59dbcc2a99c8dd9b438c4e9ccb0e4870ef92f6
change-id: 20260402-fix-idle-tick2-50a4f96df527

Best regards,
--  
Josh


             reply	other threads:[~2026-04-02 23:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 23:23 Josh Snyder [this message]
2026-04-07 13:31 ` [tip: timers/urgent] tick/nohz: Fix " tip-bot2 for Josh Snyder

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=20260402-fix-idle-tick2-v1-1-eecb589649d3@code406.com \
    --to=josh@code406.com \
    --cc=anna-maria@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sunlightlinux@gmail.com \
    --cc=tglx@kernel.org \
    /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

Powered by JetHome