mdflush.bt(8)

πŸ“¦
version 0.27.0 Β· 3 versions
  • 0.27.0 Β· alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.14.0 Β· ubuntu jammy
  • 0.20.2 Β· ubuntu noble
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ mdflush.bt πŸŽ€ β€” Trace md flush events πŸ’–

okay so mdflush.bt is a bpftrace/eBPF tool that traces md flush events 🫢 "md" is the Linux multiple device driver, aka software RAID πŸ’… Every time it flushes, you get the timestamp and the md device printed right there. Lowkey super useful for correlating those mysterious spikes in disk latency πŸ“ˆ bestie, knowing when the flushes happen is everything 😭

🌸 SYNOPSIS 🌸

mdflush.bt

πŸ¦‹ DESCRIPTION πŸ¦‹

So this tool traces flush events by md, the Linux multiple device driver (software RAID) ✨ It prints the timestamp and the md device for each flush. Knowing when these flushes happen can be seriously helpful when you're trying to match them up with unexplained spikes in disk latency πŸ”₯

Here's the tea: it works by tracing the kernel md_flush_request() function using kernel dynamic tracing 🧚 That means it'll need updating if anything changes in that function, so keep that in mind πŸ™ˆ

Also, be aware that the flushes themselves are likely coming from higher up in the I/O stack, like from the file systems πŸ’€ not the tool, not md, just the vibes from upstream.

Since this uses BPF, only the root user can use this tool. Main character energy is cute, but you need to be root πŸ‘‘

πŸ“ REQUIREMENTS πŸ“

You need CONFIG_BPF and bpftrace πŸ’œ

πŸŽ€ EXAMPLES πŸŽ€

Trace md flush events:

# mdflush.bt

πŸ’… FIELDS πŸ’…

  • TIME β€” Time of the flush event, formatted as HH:MM:SS ⏰
  • PID β€” The process ID that was on-CPU when the event was issued. This can identify the cause of the flush (eg, the sync command), but it'll often point to a kernel worker thread that was managing I/O 🧡
  • COMM β€” The command name for the PID 🏷️
  • DEVICE β€” The md device name πŸ’Ύ

🌈 OVERHEAD 🌈

Expected to be negligible ✨ basically no drama on performance 🫢

πŸ¦‹ SOURCE πŸ¦‹

This is from bpftrace πŸ’–

https://github.com/bpftrace/bpftrace

Also look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool πŸ“š

This is a bpftrace version of the bcc tool of the same name. The bcc tool may provide more options and customizations 🧚

https://github.com/iovisor/bcc

🧚 OS 🧚

Linux 🐧

🌸 STABILITY 🌸

Unstable - in development 🚧 so it's still cooking, bestie 🍳

πŸ‘‘ AUTHOR πŸ‘‘

Brendan Gregg πŸ’œ

πŸ”— SEE ALSO πŸ”—

biosnoop.bt(8) 🫢


mdflush.bt(8) is from the USER COMMANDS section, last updated 2018-09-07 πŸŽ€ Stay iconic, bestie πŸ’–βœ¨