https://github.com/mikuchi9/ebpf-prefetch-hints
An eBPF-based tool that suggests prefetching hints to the Linux kernel for frequently executed binaries in /usr/bin.
https://github.com/mikuchi9/ebpf-prefetch-hints
ebpf libbpf performance prefetch system-tools userspace
Last synced: 3 days ago
JSON representation
An eBPF-based tool that suggests prefetching hints to the Linux kernel for frequently executed binaries in /usr/bin.
- Host: GitHub
- URL: https://github.com/mikuchi9/ebpf-prefetch-hints
- Owner: mikuchi9
- License: gpl-3.0
- Created: 2025-06-19T08:08:26.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-06-19T21:53:48.000Z (10 months ago)
- Last Synced: 2025-06-19T22:33:38.191Z (10 months ago)
- Topics: ebpf, libbpf, performance, prefetch, system-tools, userspace
- Language: C
- Homepage:
- Size: 693 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## eBPF Prefetch Hints
⚡ **Speed up frequently used binaries** by hinting the Linux kernel to prefetch them — powered by eBPF.
### 🚀 What It Does
This tool uses an eBPF kernel-side program to track execution frequency of binaries under `/usr/bin`, and a user-space controller that:
- Aggregates call frequency from a BPF map
- Periodically identifies hot binaries
- Suggests prefetching those binaries via system hints
### 🔧 Features
- [x] eBPF‑based tracing of binary execution under **/usr/bin**
- [x] Maintains a frequency map of hot binaries in the kernel
- [x] **User‑defined polling interval**
• run `sudo ./prefetch_hint `
• defaults to **300 s** (5 min) when omitted
- [x] Advises the kernel with `posix_fadvise()` to **prefetch the
*.text* segment** of each hot ELF binary
### Prerequisites
- Linux kernel with eBPF support
- Clang/LLVM and libbpf-dev
- bpftool
- Root privileges
### 🛠️ Build and Run
```
make all
sudo ./prefetch_hint
```
### 📦 Header provenance
The bundled `vmlinux.h` was generated on Ubuntu 22.04.04 LTS (kernel 6.5.0, BTF enabled)
using `bpftool v7.3.0`. Regenerate with `make headers` if you need an exact match
for a custom kernel.