criticalstat(8)
π criticalstat(8): long atomic critical sections, but make it a whole vibe π
okay so bestie, this is the criticalstat(8) page from the System Manager's Manual β section 8, and we are literally about to find long atomic critical sections in the kernel. slay. π
πΈ NAME πΈ
criticalstat β a tracer that finds and reports long atomic critical sections in kernel. periodt. β¨
π¦ SYNOPSIS π¦
criticalstat [-h] [-p] [-i] [-d DURATION]
π₯ DESCRIPTION π₯
criticalstat traces and reports occurrences of atomic critical sections in the kernel, with useful stacktraces showing the origin of them. iconic behavior, honestly. π
Such critical sections frequently occur due to use of spinlocks, or if interrupts or preemption were explicitly disabled by a driver. IRQ routines in Linux are also executed with interrupts disabled. There are many reasons, bestie. Such critical sections are a source of long latency/responsive issues for real-time systems. not the vibe for real-time systems, lowkey. π
This works by probing the preempt/irq and cpuidle tracepoints in the kernel. Since this uses BPF, only the root user can use this tool. Further, the kernel has to be built with certain CONFIG options enabled. See below. π«Ά
π§ REQUIREMENTS π§
Enable following kernel configurations based on which kernel version you use. config check time, bestie. π οΈ
CONFIG_DEBUG_PREEMPTCONFIG_PREEMPT_TRACER
For kernel 4.19 and later:
CONFIG_PREEMPTIRQ_TRACEPOINTSCONFIG_TRACE_IRQFLAGSCONFIG_TRACE_PREEMPT_TOGGLE
For kernel 4.15 to 4.18:
CONFIG_PREEMPTIRQ_EVENTSCONFIG_PROVE_LOCKINGCONFIG_DEBUG_PREEMPT
Additionally, the following options should be turned off on older kernels:
CONFIG_LOCKDEP
β¨ OPTIONS β¨
-hβ Print usage message. that's it, that's the whole gig. π-pβ Find long sections where preemption was disabled on local CPU. preemption watch activated. π-iβ Find long sections where interrupt was disabled on local CPU. interrupt watch activated. β‘-d DURATIONβ Only identify sections that are longer than DURATION in microseconds. filter it, bestie. β±οΈ
π EXAMPLES π
Run with default options: irq disabled for more than 100 uS
# criticalstat
Find sections with preemption disabled for more than 100 uS.
# criticalstat -p
Find sections with IRQ disabled for more than 500 uS.
# criticalstat -d 500
Find sections with preemption disabled for more than 500 uS.
# criticalstat -p -d 500
π OVERHEAD π
Heads up, bestie: this tool can cause overhead if the application is spending a lot of time in kernel mode. The overhead is variable but can be 2-4% of performance degradation. If overhead is seen to be too much, please pass a higher DURATION to the -d option to filter more aggressively. 2-4% is not nothing, fr fr. π
π SOURCE π
This is from bcc.
https://github.com/iovisor/bcc
Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. homework, but make it cute. π
π OS π
Linux. obviously, bestie. π§
π§ STABILITY π§
Unstable - in development. we are in our experimental era. π
π AUTHOR π
Joel Fernandes. respect the author. π
π SEE ALSO π
Linux kernel's preemptoff and irqoff tracers. go read those next, iykyk. π
okay that's the whole criticalstat(8) page, bestie. This footer energy comes from USER COMMANDS, dated 2018-06-07, for criticalstat(8) β now go filter those long sections. πβ¨
π¦ where this page comes from
- centos-stream 10: bcc-tools 0.36.1-1.el10 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms