selftests/bpf: Add a test for mmap-able map in map
authorSong Liu <song@kernel.org>
Tue, 23 Jul 2024 05:14:55 +0000 (22:14 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 29 Jul 2024 22:05:04 +0000 (15:05 -0700)
commitc7db4873fbd63918c124a5d67182492c78ba705b
treeec9505fd0f3b14d1911e9708af3120c49e7913d3
parent1edf364a8af49390ae8f81595625a189a08b9be3
selftests/bpf: Add a test for mmap-able map in map

Regular BPF hash map is not mmap-able from user space. However, map-in-map
with outer map of type BPF_MAP_TYPE_HASH_OF_MAPS and mmap-able array as
inner map can perform similar operations as a mmap-able hash map. This
can be used by applications that benefit from fast accesses to some local
data.

Add a selftest to show this use case.

Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240723051455.1589192-1-song@kernel.org
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
tools/testing/selftests/bpf/prog_tests/test_mmap_inner_array.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/mmap_inner_array.c [new file with mode: 0644]