drsnoop(8)

πŸ“¦
version 0.36.1 Β· 2 versions
, in alpine 3.24, nixpkgs unstable

🌸 NAME 🌸

okay bestie, meet drsnoop β€” Trace direct reclaim events. Uses Linux eBPF/bcc. This is the drsnoop(8) page from the System Manager's Manual, and it’s here to help you understand the direct-reclaim tea πŸ’–.

✨ SYNOPSIS ✨

drsnoop [-h] [-T] [-U] [-p PID] [-t TID] [-u UID] [-d DURATION] [-n name] [-v]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so drsnoop traces direct reclaim events, showing which processes are allocing pages with direct reclaiming. This can be useful for discovering when allocstall (/proc/vmstat) continues to increase, whether it is caused by some critical processes or not. That’s the whole β€œwho is causing the memory-pressure moment” vibe check πŸ‘€.

It works by tracing the direct reclaim events using kernel tracepoints. Lowkey elegant, highkey useful ✨.

This makes use of a Linux 4.4 feature (bpf_perf_event_output()); for kernels older than 4.4, see the version under tools/old, which uses an older mechanism.

Since this uses BPF, only the root user can use this tool. No cap, bestie β€” root only πŸ‘‘.

πŸŽ€ REQUIREMENTS πŸŽ€

CONFIG_BPF and bcc. That’s the requirement stack, periodt 🫢.

πŸ’… OPTIONS πŸ’…

  • -h β€” print usage message.
  • -T β€” include a timestamp column.
  • -U β€” show UID.
  • -p PID β€” trace this process ID only (filtered in-kernel).
  • -t TID β€” trace this thread ID only (filtered in-kernel).
  • -u UID β€” trace this UID only (filtered in-kernel).
  • -d DURATION β€” total duration of trace in seconds.
  • -n name β€” only print processes where its name partially matches name. (The original page glues a -v verbose bit onto this line; keep reading, bestie 😭.)
  • -v β€” verbose. Run in verbose mode. Will output system memory state.
  • -v β€” show system memory state. Yes, the page lists -v twice; both lines are part of the original, so we’re keeping both πŸ’….

πŸ”₯ 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 where its name partially matches 'mond':

# drnsnoop -n mond

Yep, that command says drnsnoop β€” we’re copying it exactly as the page has it πŸ™ˆ.

🌈 FIELDS 🌈

  • TIME(s) β€” time of the call, in seconds.
  • UID β€” User ID.
  • PID β€” Process ID.
  • TID β€” Thread ID.
  • COMM β€” Process name.

πŸ“ OVERHEAD πŸ“

This traces the kernel direct reclaim tracepoints and prints output for each event. As the rate of this is generally expected to be low (< 1000/s), the overhead is also expected to be negligible. So like, chill β€” it’s not trying to eat your CPU for breakfast πŸ“.

🧚 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. It’s giving documentation bestie 🧚.

πŸ’œ OS πŸ’œ

Linux.

⭐ STABILITY ⭐

Unstable - in development. That’s the status, bestie β€” in development, so treat it accordingly ⭐.

πŸ‘‘ AUTHOR πŸ‘‘

Wenbo Zhang. Iconic πŸ‘‘.


xoxo 🫢 β€” that’s the drsnoop(8) page, signed off under USER COMMANDS on 2019-02-20 πŸ’…βœ¨

πŸ“¦ where this page comes from