On Wed, Jul 22, 2026 at 11:42:58AM -0700, JP Kobryn wrote:
On 7/21/26 10:48 AM, Ziyang Men wrote:
Add a test_progs selftest that verifies the memory-cgroup BPF kfuncs
return values that agree with what userspace reads from cgroupfs, across
a whole cgroup subtree that has been charged on many CPUs.
It complements the existing cgroup_iter_memcg test. cgroup_iter_memcg
calls the memcg kfuncs on a single cgroup (BPF_CGROUP_ITER_SELF_ONLY) and
only asserts each value is greater than zero, so it never checks that a
value is actually correct. This test compares the kfunc values against
what userspace reads from memory.stat, and checks every node in the
cgroup tree.
Can you extend the existing test instead of adding a new one?
Hi JP,
Good suggestion. Actually extending the exisiting one was the plan in the v1.
However, existing selftests with similar purpose is the cgroup_iter_memcg, which
is in the bpf/. After discussed with the bpf reviewer in v1, we think this
selftest may suit better in the cgroup/ rather than the bpf/, since 1) it tests
the cgroup functionalities (bpf is a tool), and 2) together with the selftest,
this patch serials also ships a common Makefile lib.bpf.mk for easily compiling
selftests for other subsystems using bpf. Currently there is no other selftests
in cgroup/ relies on BPF and we think it is good to put this selftest here as
the first consumer.
We appreciate any possible suggestions. Thanks very much!
Best,
Ziyang