drsnoop(8)
π§ drsnoop(8) β¨ System Manager's Manual β¨
Okay bestie, this is the manual for drsnoop, a tool for tracing direct reclaim events π It's part of Linux eBPF/bcc, so it's giving low-level and I'm obsessed.
π NAME
drsnoop - Trace direct reclaim events. Uses Linux eBPF/bcc. π
π SYNOPSIS
drsnoop [-h] [-T] [-U] [-p PID] [-t TID] [-u UID] [-d DURATION] [-n
name] [-v]
π₯ DESCRIPTION
Okay so drsnoop traces direct reclaim events and shows you which processes are allocing pages with direct reclaiming. It's lowkey so useful for figuring out why allocstall (/proc/vmstat) keeps climbing, and whether some critical processes are the ones causing it π
It works by tracing the direct reclaim events using kernel tracepoints π¦
This makes use of a Linux 4.4 feature (bpf_perf_event_output()). For kernels older than 4.4, check the version under tools/old, which uses an older mechanism πΈ
Since this uses BPF, only the root user can use this tool. No cap, you need to be root π
π§° REQUIREMENTS
You'll need CONFIG_BPF and bcc β¨
π OPTIONS
-hβ the usage message, for when you forget everything π-Tβ adds a timestamp column π-Uβ shows the UID π«Ά-p PIDβ traces only this process ID (filtered in-kernel) π―-t TIDβ traces only this thread ID (filtered in-kernel) π§΅-u UIDβ traces only this UID (filtered in-kernel) π-d DURATIONβ how long the trace runs in total, in seconds β³-n nameβ only prints processes whose name partially matchesnameπ-vβ verbose mode, which also outputs the system memory state π§
π EXAMPLES
Trace all direct reclaim events:
# drsnoop
Trace all direct reclaim events, for 10 seconds only:
# drsnoop -d 10
Trace all direct reclaim events, and include timestamps:
# drsnoop -T
Show UID:
# drsnoop -U
Trace PID 181 only:
# drsnoop -p 181
Trace UID 1000 only:
# drsnoop -u 1000
Trace all direct reclaim events from processes whose name partially matches 'mond':
# drnsnoop -n mond
π FIELDS
TIME(s)β when the call happened, in seconds β°UIDβ the User ID πͺͺPIDβ the Process ID πTIDβ the Thread ID π§΅COMMβ the process name π·οΈ
πΈ OVERHEAD
This traces the kernel direct reclaim tracepoints and prints output for each event. The rate is generally expected to be low (< 1000/s), so the overhead is also expected to be negligible, which is very chill π
π SOURCE
This is from bcc π
https://github.com/iovisor/bcc
Also look in the bcc distribution for a companion _examples.txt file, which has example usage, output, and commentary for this tool π
π» OS
Linux π§
π§ͺ STABILITY
Unstable, still in development π§
π©βπ» AUTHOR
Wenbo Zhang π
That's the whole tea, bestie π«Άβ¨ Man page drsnoop(8), from the User Commands section, dated 2019-02-20 π Go trace something iconic π¦π
π¦ where this page comes from
- debian bookworm: bpfcc-tools 0.26.0+ds-1 Β· Apache-2.0
- debian trixie: bpfcc-tools 0.31.0+ds-7 Β· Apache-2.0
- ubuntu noble: bpfcc-tools 0.29.1+ds-1ubuntu7 Β· Apache-2.0
- ubuntu questing: bpfcc-tools 0.31.0+ds-7ubuntu2 Β· Apache-2.0
- ubuntu resolute: bpfcc-tools 0.35.0+ds-1ubuntu2 Β· Apache-2.0
- ubuntu stonking: bpfcc-tools 0.35.0+ds-1ubuntu4 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms