]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf: selftests: selftests for memcg stat kfuncs
authorJP Kobryn <inwardvessel@gmail.com>
Tue, 23 Dec 2025 04:41:55 +0000 (20:41 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 23 Dec 2025 06:20:22 +0000 (22:20 -0800)
commit6bce6ddbe634bbc6d21672b5bfdbb5ad0409bd8d
tree164a4b3c8ebe6c51b23d8110125297273fda5db6
parent99430ab8b804c26b8a0dec93fcbfe75469f3edc7
bpf: selftests: selftests for memcg stat kfuncs

Add test coverage for the kfuncs that fetch memcg stats. Using some common
stats, test scenarios ensuring that the given stat increases by some
arbitrary amount. The stats selected cover the three categories represented
by the enums: node_stat_item, memcg_stat_item, vm_event_item.

Since only a subset of all stats are queried, use a static struct made up
of fields for each stat. Write to the struct with the fetched values when
the bpf program is invoked and read the fields in the user mode program for
verification.

Signed-off-by: JP Kobryn <inwardvessel@gmail.com>
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
Link: https://lore.kernel.org/r/20251223044156.208250-6-roman.gushchin@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/cgroup_iter_memcg.h [new file with mode: 0644]
tools/testing/selftests/bpf/prog_tests/cgroup_iter_memcg.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/cgroup_iter_memcg.c [new file with mode: 0644]