[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250626142017.26372-1-wander@redhat.com>
Date: Thu, 26 Jun 2025 11:20:08 -0300
From: Wander Lairson Costa <wander@...hat.com>
To: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>,
Mel Gorman <mgorman@...e.de>,
Valentin Schneider <vschneid@...hat.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Wander Lairson Costa <wander@...hat.com>,
David Woodhouse <dwmw@...zon.co.uk>,
Thomas Gleixner <tglx@...utronix.de>,
Boqun Feng <boqun.feng@...il.com>,
linux-kernel@...r.kernel.org (open list),
linux-trace-kernel@...r.kernel.org (open list:TRACING)
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Clark Williams <williams@...hat.com>,
Gabriele Monaco <gmonaco@...hat.com>
Subject: [PATCH 0/2] tracing/preemptirq: Optimize disabled tracepoint overhead
This series addresses unnecessary overhead introduced by the
preempt/irq tracepoints when they are compiled into the kernel
but are not actively enabled (i.e., when tracing is disabled).
These optimizations ensure that when tracing is inactive, the kernel
can largely bypass operations that would otherwise incur a passive
performance penalty. This makes the impact of disabled preemptirq
IRQ and preempt tracing negligible in performance-sensitive environments.
Wander Lairson Costa (2):
trace/preemptirq: reduce overhead of irq_enable/disable tracepoints
tracing/preemptirq: Optimize preempt_disable/enable() tracepoint
overhead
---
Performance Measurements
Measurements were taken using a specialized kernel module [1] to benchmark
`local_irq_disable/enable()` and `preempt_disable/enable()` call pairs.
The kernel used for benchmarking was version 6.16.0-rc2. "Max Average"
represents the average of the 1000 highest samples, used to reduce noise
from single highest samples.
Each benchmark run collected 10^7 samples in parallel from each CPU
for each call pair (used for average, max_avg, and median calculations).
The 99th percentile was measured in a separate benchmark run, focused
on a single CPU.
The results show that compiling with tracers (Kernel Build:
`-master-trace`) introduced significant overhead compared to a base
kernel without tracers (Kernel Build: `-master`). After applying these
patches (Kernel Build: `-patched-trace`), the overhead is
substantially reduced, approaching the baseline.
x86-64 Metrics
Tests were run on a system equipped with an Intel(R) Xeon(R) Silver 4310 CPU.
IRQ Metrics
Combined Metric average max_avg median percentile
Kernel Build
6.16.0-rc2-master 28 5587 29 23
6.16.0-rc2-master-trace 46 7895 48 32
6.16.0-rc2-patched-trace 30 6030 31 27
Preempt Metrics
Combined Metric average max_avg median percentile
Kernel Build
6.16.0-rc2-master 26 5748 27 20
6.16.0-rc2-master-trace 45 7526 48 26
6.16.0-rc2-patched-trace 27 5479 27 21
AArch64 Metrics
Tests were also conducted on an AArch64 platform.
IRQ Metrics
Combined Metric average max_avg median percentile
Kernel Build
aarch64-6.16.0-rc2-master 28 3298 32 64
aarch64-6.16.0-rc2-master-trace 105 5769 96 128
aarch64-6.16.0-rc2-patched-trace 29 3192 32 64
Preempt Metrics
Combined Metric average max_avg median percentile
Kernel Build
aarch64-6.16.0-rc2-master 27 3371 32 32
aarch64-6.16.0-rc2-master-trace 32 3000 32 64
aarch64-6.16.0-rc2-patched-trace 28 3132 32 64
Suggested-by: Steven Rostedt <rostedt@...dmis.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Clark Williams <williams@...hat.com>
Cc: Gabriele Monaco <gmonaco@...hat.com>
Cc: Juri Lelli <juri.lelli@...hat.com>
---
References:
[1] https://github.com/walac/tracer-benchmark
Wander Lairson Costa (2):
trace/preemptirq: reduce overhead of irq_enable/disable tracepoints
tracing/preemptirq: Optimize preempt_disable/enable() tracepoint
overhead
include/linux/irqflags.h | 25 +++++++++++++++--------
include/linux/preempt.h | 35 ++++++++++++++++++++++++++++++---
kernel/sched/core.c | 12 +----------
kernel/trace/trace_preemptirq.c | 22 +++++++++++++++++++++
4 files changed, 72 insertions(+), 22 deletions(-)
--
2.50.0
Powered by blists - more mailing lists