---
title: "Lock-free per-CPU maps"
---

> Documentation Index
> Fetch the complete documentation index at: https://example.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Lock-free per-CPU maps

`BPF_MAP_TYPE_PERCPU_ARRAY` and `BPF_MAP_TYPE_LRU_PERCPU_HASH` give every CPU core its own private slot for every key. Hooks update their local slot with *zero* locks and zero atomics.

The user-space daemon sums across `0..num_possible_cpus` once per scrape (every 5–15 seconds). That shifts aggregation off the hot packet path entirely.

## What changed

- Shared hash bucket → private slot per CPU core
- Atomic cache bounce → plain L1-local increment
- Hot-path work → cold-path summation on scrape

> **Key idea:** In AGILITY Kernel Profiler, every softirq and kfree_skb map uses PERCPU_ARRAY or LRU_PERCPU_HASH so 128-core telco hosts never contend.

Source: https://example.com/ebpf-field-guide/core-architecture/maps-and-data/per-cpu/index.mdx
