|System Manager's Manual
swapin - Count swapins by process. Uses BCC/eBPF.
This tool counts swapins by process, to show which process is affected by swapping (if swap devices are in use). This can explain a significant source of application latency, if it has began swapping due to memory pressure on the system.
This works by tracing the swap_readpage() kernel funciton using dynamic instrumentation. This tool may need maintenance to keep working if that function changes in later kernels.
Since this uses BPF, only the root user can use this tool.
CONFIG_BPF and BCC.
- The process name.
- The process ID.
- The count of swapins during that interval.
The rate of swapins should be low (bounded by swapin device IOPS), such that the overhead of this tool is expected to be negligible.
This originated as a bpftrace tool from the book "BPF Performance Tools", published by Addison Wesley (2019):
See the book for more documentation on this tool.
This version is in the BCC repository:
Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool.
Unstable - in development.