- ORDERING
- global FIFO
- COPIES
- 1 (reserve)
- MEMORY
- shared ring
- KERNEL
- Linux 5.8+
- CPU hook write
- userspace read / poll
- ringbuf event stream
Counters fit maps, but captured packets and trace events must stream to user space. BPF RingBuf (BPF_MAP_TYPE_RINGBUF) is a single multi-producer, single-consumer circular buffer shared across CPUs.
Unlike the older PERF_EVENT_ARRAY (one ring per CPU, out-of-order events, wasted RAM), RingBuf preserves global timestamp order and lets hooks write directly via bpf_ringbuf_reserve() without an extra stack copy.
What changed
- Per-CPU perf rings → one shared memory-mapped ring
- Out-of-order merge → strict cross-CPU event order
- Stack copy → direct reserve & submit zero-copy