---
name: "readahead-bpfcc"
section: "8"
platform: "linux"
package: "bpfcc-tools"
version: "0.31.0+ds-7"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/readahead-bpfcc"
---

# readahead-bpfcc(8)

Show performance of read-ahead cache

## NAME

readahead - Show performance of read-ahead cache

## SYNOPSIS

**readahead \[-d DURATION\]**

## DESCRIPTION

The tool shows the performance of read-ahead caching on the system under a given load to investigate any  caching issues. It shows a count of unused pages in the cache and also prints a histogram showing how  long they have remained there.

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 as well as see how many are left unaccessed.

Since this uses BPF, only the root user can use this tool.

### 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.

## REQUIREMENTS

CONFIG\_BPF, bcc

## OPTIONS

\-h Print usage message

- \-d DURATION

  Trace the read-ahead caching system for DURATION seconds

## EXAMPLES

- Trace for 30 seconds and show histogram of page age (ms) in read-ahead cache along with unused page count:

  \# **readahead -d 30**

## 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.

## 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)](/readahead/2.md), [madvise(2)](/madvise/2.md)
