diff options
author | Hou Tao <houtao1@huawei.com> | 2025-04-01 14:22:50 +0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2025-04-09 20:12:54 -0700 |
commit | 7c6fb1cf33fb9a7b89a0d9feada957d0fe56de6f (patch) | |
tree | e9e00761dd4013c0d79131ba93ab6993c30d6260 /tools/perf/scripts/python/export-to-sqlite.py | |
parent | 6704b1e8cfc5eed264065735fe00a1dd8a0bffef (diff) |
selftests/bpf: Add test case for atomic update of fd htab
Add a test case to verify the atomic update of existing elements in the
htab of maps. The test proceeds in three steps:
1) fill the outer map with keys in the range [0, 8]
For each inner array map, the value of its first element is set as the
key used to lookup the inner map.
2) create 16 threads to lookup these keys concurrently
Each lookup thread first lookups the inner map, then it checks whether
the first value of the inner array map is the same as the key used to
lookup the inner map.
3) create 8 threads to overwrite these keys concurrently
Each update thread first creates an inner array, it sets the first value
of the array to the key used to update the outer map, then it uses the
key and the inner map to update the outer map.
Without atomic update support, the lookup operation may return -ENOENT
during the lookup of outer map, or return -EINVAL during the comparison
of the first value in the inner map and the key used for inner map, and
the test will fail. After the atomic update change, both the lookup and
the comparison will succeed.
Given that the update of outer map is slow, the test case sets the loop
number for each thread as 5 to reduce the total running time. However,
the loop number could also be adjusted through FD_HTAB_LOOP_NR
environment variable.
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20250401062250.543403-7-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions