writeback.bt(8)
π writeback.bt π
okay bestie, so this is writeback.bt from section 8 of the System Manager's Manual, and it's literally one of the most useful little gremlins in the bpftrace toolkit. no cap.
β¨ NAME β¨
writeback.bt β trace file system writeback events with details. uses bpftrace/eBPF. π¦
πΈ SYNOPSIS πΈ
writeback.bt
that's it. no flags, no args, just vibes and root privileges. π
π DESCRIPTION π
so what this does is it traces when your file system's dirtied pages get flushed to disk by kernel writeback, and then it prints out all the deets β like when the event happened, and how long the event took. super main character behavior tbh.
why do you care? because it's great for correlating those times with other performance problems. if there's a match? that's your clue that the problem might be caused by writeback. π΅οΈββοΈ
and here's the tea: how quickly the kernel does writeback is tunable. check the kernel docs, like, for example vm.dirty_writeback_centisecs.
it's doing all this using two tracepoints:
tracepoint:writeback:writeback_starttracepoint:writeback:writeback_written
β οΈ okay important: since this uses BPF, only the root user can use this tool. no root, no writeback tea. periodt.
π REQUIREMENTS π
CONFIG_BPFbpftrace
both. you need both. it's giving "dynamic duo". π
β EXAMPLES β
trace all writeback events with timestamps and latency details:
# writeback.bt
yes queen, that's the whole example. she's simple, she's effective. π
π₯ FIELDS π₯
here's what each column is serving, bestie:
TIMEβ the time that the writeback event completed, in%H:%M:%Sformat.DEVICEβ device name inmajor:minornumber format.PAGESβ pages written during writeback.REASONβ reason for the writeback event. this may be"background","vmscan","sync","periodic", etc.msβ duration of the writeback event in milliseconds.
π¦ OVERHEAD π¦
since writeback events are expected to be infrequent β like, less than <10/sec β the overhead of this tool is expected to be negligible, near 0%. so you can lowkey just leave it running. obsessed. β¨
π SOURCE π
this is from bpftrace.
https://github.com/iovisor/bpftrace
also, look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. it's the director's cut. π¬
πΈ OS πΈ
Linux
π STABILITY π
Unstable β in development.
(so like, she's growing. be nice to her. π)
π AUTHOR π
Brendan Gregg
π«Ά SEE ALSO π«Ά
and that's the whole page, bestie!! this was writeback.bt(8) from the USER COMMANDS section, dated 2018-09-14. go forth and trace those writebacks, you absolute icon. πβ¨π
π¦ where this page comes from
- debian bookworm: bpftrace 0.17.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms