This series adds a mechanism to report "map pressure" (read as "the current number of elements" for most maps) to userspace. The primary reason for adding this functionality in our case (Cilium) is to get signals about how full some heavy-used maps are and what the actual dynamic profile of map capacity is. In the case of RCU maps this is impossible to get this information anyhow else. See also [1]. The first patch in the series adds the api and implements the ops for all maps in hashtab.c + for the lpm_trie.c (the maps which are of most interest for us). See the commit description for additional details. The second commit adds a new map selftest map_tests/map_pressure.c. [1] https://lpc.events/event/16/contributions/1368/ Anton Protopopov (2): bpf: add new map ops ->map_pressure selftests/bpf: test map pressure include/linux/bpf.h | 1 + include/uapi/linux/bpf.h | 2 +- kernel/bpf/hashtab.c | 118 ++++--- kernel/bpf/lpm_trie.c | 8 + kernel/bpf/syscall.c | 15 + tools/include/uapi/linux/bpf.h | 2 +- .../selftests/bpf/map_tests/map_pressure.c | 307 ++++++++++++++++++ 7 files changed, 406 insertions(+), 47 deletions(-) create mode 100644 tools/testing/selftests/bpf/map_tests/map_pressure.c -- 2.34.1