readahead(8)
β¨ readahead(8) β System Manager's Manual β¨
Okay bestie, let's talk about readahead(8) π
π This is the manual page for the readahead tool, and it's giving "show me the cache receipts" energy π§Ύπ
πΈ NAME πΈ
readahead β Show performance of read-ahead cache β¨
π¦ SYNOPSIS π¦
readahead [-d DURATION]
π DESCRIPTION π
So this tool shows you how well read-ahead caching is doing on your system under a given load π It's the go-to when something about caching feels sus π΅οΈββοΈ It counts how many pages are sitting in the cache unused, and it also prints a histogram of how long they've been hanging out there β³
Lowkey the way it works is it traces the __do_page_cache_readahead() kernel function to track entry and exit in the readahead mechanism in the kernel π Then it uses the __page_cache_alloc() and mark_page_accessed() functions to figure out the age of each page in the cache, and to see how many are left unaccessed π«Ά
Since this uses BPF, only the root user can use this tool π₯ No cap, so don't even try it as a regular user π
π NOTE ON KPROBES USAGE π
Okay, real talk: this tool uses Kprobes, so it depends on how your Linux kernel was compiled π οΈ These functions might be inlined, which means they won't be available for Kprobes π To check, look at the vmlinux source and binary and confirm whether inlining is happening π You can also check /proc/kallsyms on the host and verify that the target functions are present there before using this π§
π REQUIREMENTS π
CONFIG_BPF, bcc π
β¨ OPTIONS β¨
-hβ Prints the usage message π-d DURATIONβ Traces the read-ahead caching system forDURATIONseconds β±οΈ
π EXAMPLES π
Trace for 30 seconds and show a histogram of page age (ms) in the read-ahead cache, along with the unused page count π
# readahead -d 30
π OVERHEAD π
β οΈ Bestie, watch out! The kernel functions this program instruments could be high-frequency depending on the application's profile (for example, sequential IO) π± Please measure and monitor the overhead before leaving this turned on in production environments π
π 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 π€
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 π
π§ OS π§
Linux π§
π§ͺ STABILITY π§ͺ
Unstable - in development π§
π©βπ» AUTHOR π©βπ»
Suchakra Sharma π«Ά
π SEE ALSO π
readahead(2), madvise(2) π«
Periodt, that's the whole tea βπ Source is the bcc/iovisor project, version and date are USER COMMANDS 2020-08-20 π Stay iconic and keep those caches clean, bestie π¦β¨
π¦ 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 jammy: bpfcc-tools 0.18.0+ds-2 Β· 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