readahead(8)
π readahead(8) β like, the manual page, but make it cute β¨
Okay bestie, so readahead is this icon in the System Manager's Manual and she is literally here to show you the performance of your read-ahead cache. No cap, she's serving main character energy for your kernel. π
πΈ NAME πΈ
readahead β literally shows you the performance of the read-ahead cache, periodt.
β¨ SYNOPSIS β¨
readahead [-d DURATION]
π¦ DESCRIPTION π¦
So the way this works: readahead shows you how the read-ahead caching is doing on your system under a given load, so you can investigate any caching issues you're lowkey stressed about. It shows a count of unused pages in the cache and also prints a histogram showing how long they've been chilling there. Obsessed. π
This tool traces the __do_page_cache_readahead() kernel function to track entry and exit in the readahead mechanism in the kernel, and then uses __page_cache_alloc() and mark_page_accessed() functions to calculate the age of the page in the cache and see how many are left unaccessed. It's giving β¨ forensic vibes β¨.
π¨ Since this uses BPF, only the root user can use this tool. Sorry bestie, no root no slay. π₯
π NOTE ON KPROBES USAGE π
Since the tool uses Kprobes, depending on your linux kernel's compilation, these functions may be inlined and hence not available for Kprobes. π To see whether you have the functions available, check vmlinux source and binary to confirm whether inlining is happening or not. You can also check /proc/kallsyms on the host and verify if the target functions are present there before using this. Do your vibe check first, bestie, don't just run it blind. π
π REQUIREMENTS π
CONFIG_BPFbcc
That's it, that's the list. Iconic. π
π OPTIONS π
-hβ prints the usage message, like a little friendly reminder. π«Ά-d DURATIONβ traces the read-ahead caching system forDURATIONseconds. Time it like a reel. β±οΈ
π EXAMPLES π
Trace for 30 seconds and show histogram of page age (ms) in read-ahead cache along with unused page count:
# readahead -d 30
Literally that simple. Ate. π
π₯ OVERHEAD π₯
The kernel functions instrumented by this program could be high-frequency depending on the profile of the application (for example sequential IO). We advise the users to measure and monitor the overhead before leaving this turned on in production environments. π
Translation: measure first, bestie. Don't just leave it running in prod and hope for the best. That's not the move. π«
π§ SOURCE π§
This originated as a bpftrace tool from the book "BPF Performance Tools", published by Addison Wesley (2019):
http://www.brendangregg.com/bpf-performance-tools-book.html
See the book for more documentation on this tool. It's giving required reading. π
This version is in the BCC repository:
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. Go look, it's cute. πΈ
π OS π
Linux. Obviously. π§
β STABILITY β
Unstable β in development. She's a work in progress, and honestly? Same. π«Ά
π AUTHOR π
Suchakra Sharma. Respect the icon who built her. π
π SEE ALSO π
Go read those too, iykyk. π
And that's the whole page, bestie! π Shoutout to the BCC crew and the USER COMMANDS source, dated 2020-08-20 β mwah! π No cap, you're now fully educated on readahead. Slay. β¨
π¦ where this page comes from
- centos-stream 10: bcc-tools 0.36.1-1.el10 Β· Apache-2.0
- centos-stream 9: bcc-tools 0.36.1-1.el9 Β· ASL 2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms