From: "Ionut Nechita (Sunlight Linux)" <sunlightlinux@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>
Cc: Ionut Nechita <sunlightlinux@gmail.com>,
Ingo Molnar <mingo@kernel.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Ionut Nechita <ionut_n2001@yahoo.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] tick/nohz: Optimize check_tick_dependency() with early return
Date: Wed, 28 Jan 2026 09:45:43 +0200 [thread overview]
Message-ID: <20260128074558.15433-3-sunlightlinux@gmail.com> (raw)
Avoid iterating through individual tick dependency bits when the
tick_stop tracepoint is disabled, which is the common case. When
tracing is disabled, we can return immediately based on the atomic
value being zero or non-zero, skipping the per-bit evaluation.
This optimization improves the hot path performance of tick dependency
checks across all contexts (idle and non-idle), not just nohz_full CPUs.
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
---
kernel/time/tick-sched.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 34b341b66f220..2c1236a1cd364 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -332,6 +332,9 @@ static bool check_tick_dependency(atomic_t *dep)
{
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;
--
2.52.0
next reply other threads:[~2026-01-28 7:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 7:45 Ionut Nechita (Sunlight Linux) [this message]
2026-01-30 9:03 ` [tip: timers/core] tick/nohz: Optimize check_tick_dependency() with early return tip-bot2 for Ionut Nechita (Sunlight Linux)
2026-01-30 16:28 ` tip-bot2 for Ionut Nechita (Sunlight Linux)
2026-01-30 21:47 ` tip-bot2 for 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=20260128074558.15433-3-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