tick/nohz: fix inverted return value in check_tick_dependency() fast path
PATCH 1/1 tick/nohz: fix inverted return value in check_tick_dependency() fast path
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.
--- kernel/time/tick-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-sched.c +1 -1
@@ -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,
Signature · 1 line
Josh
[tip: timers/urgent] tick/nohz: Fix inverted return value in check_tick_dependency() fast path
The following commit has been merged into the timers/urgent branch of tip:
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: 82b915051d32a68ea3bbe261c93f5620699ff047 Gitweb: https://git.kernel.org/tip/82b915051d32a68ea3bbe261c93f5620699ff047 Author: Josh Snyder <[email protected]> AuthorDate: Thu, 02 Apr 2026 16:23:38 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 07 Apr 2026 15:30:21 +02:00
tick/nohz: Fix inverted return value in check_tick_dependency() fast path
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 this by returning !!val instead of !val, matching the slow-path semantics.
--- kernel/time/tick-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-sched.c +1 -1
@@ -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 );