mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 06:46:35 +01:00
tick/nohz: Optimize check_tick_dependency() with early return
There is no point in iterating through individual tick dependency bits when the tick_stop tracepoint is disabled, which is the common case. When the trace point is disabled, 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 <[email protected]> Signed-off-by: Ionut Nechita (Sunlight Linux) <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://patch.msgid.link/[email protected]
This commit is contained in:
1 parent
3db5306b0b
commit
56534673ce
1 file changed
+3
@@ -344,6 +344,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;
|
||||
|
||||
Reference in new issue
Block a user