OSDN Git Service

selftests/bpf: Simplify cgroup_hierarchical_stats selftest
authorYosry Ahmed <yosryahmed@google.com>
Mon, 19 Sep 2022 17:53:30 +0000 (17:53 +0000)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 23 Sep 2022 20:59:08 +0000 (13:59 -0700)
commite0401dce5e28fb7118dbfd055c77d94433778a85
tree9d61f5aac9cf7e44967bf7b3bb5e4ec1a0b97c01
parentee9bb9b4459ab7e27de9c9f91773ade2909c6375
selftests/bpf: Simplify cgroup_hierarchical_stats selftest

The cgroup_hierarchical_stats selftest is complicated. It has to be,
because it tests an entire workflow of recording, aggregating, and
dumping cgroup stats. However, some of the complexity is unnecessary.
The test now enables the memory controller in a cgroup hierarchy, invokes
reclaim, measure reclaim time, THEN uses that reclaim time to test the
stats collection and aggregation. We don't need to use such a
complicated stat, as the context in which the stat is collected is
orthogonal.

Simplify the test by using a simple stat instead of reclaim time, the
total number of times a process has ever entered a cgroup. This makes
the test simpler and removes the dependency on the memory controller and
the memory reclaim interface.

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: KP Singh <kpsingh@kernel.org>
Link: https://lore.kernel.org/bpf/20220919175330.890793-1-yosryahmed@google.com
tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c
tools/testing/selftests/bpf/progs/cgroup_hierarchical_stats.c