Skip to content

Fix test_cgroup_iter_memcg issues found during back-porting

Hui Zhu bpf linux-kselftest lkml 5 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 0 repliesApplied 2/2
  2. v43 patches 3 repliesSuperseded
  3. v33 patches 4 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v23 patches1 replySuperseded
v13 patches5 repliesSuperseded

Changes in v5 from the cover letter

According to the comments of Emil Tsalapatis and JP Kobryn, dropped "selftests/bpf: Check bpf_mem_cgroup_page_state return value". v4:
Fixed wrong git commit log in "bpf: Use bpf_core_enum_value for stats in cgroup_iter_memcg".

Patches in v5 All 2 applied

#Subject and filesSizeRepliesApplied
1/2selftests/bpf: Remove kmem subtest from cgroup_iter_memcgtools/testing/selftests/bpf/cgroup_iter_memcg.h tools/testing/selftests/bpf/prog_tests/cgroup_iter_memcg.c tools/testing/selftests/bpf/progs/cgroup_iter_memcg.c+0 -310 repliesApplied
2/2bpf: Use bpf_core_enum_value for stats in cgroup_iter_memcgtools/testing/selftests/bpf/progs/cgroup_iter_memcg.c+12 -50 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJP KobrynEmil Tsalapatis
1/2R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH bpf-next v5 0/2] Fix test_cgroup_iter_memcg issues found during back-porting

From: Hui Zhu <[email protected]>

While back-porting "mm: bpf kfuncs to access memcg data", I encountered issues with test_cgroup_iter_memcg, specifically in test_kmem.
The test_cgroup_iter_memcg test would falsely pass when bpf_mem_cgroup_page_state() failed due to incompatible enum values across kernel versions. Additionally, test_kmem would fail on systems with cgroup.memory=nokmem enabled.

These patches are my fixes for the problems I encountered.

Changelog:
v5:
According to the comments of Emil Tsalapatis and JP Kobryn, dropped "selftests/bpf: Check bpf_mem_cgroup_page_state return value". v4:
Fixed wrong git commit log in "bpf: Use bpf_core_enum_value for stats in cgroup_iter_memcg".
v3:
According to the comments of JP Kobryn, remove kmem subtest from cgroup_iter_memcg and fix assertion string in test_pgfault. v2:
According to the comments of JP Kobryn, added bpf_core_enum_value() usage in the BPF program to handle cross-kernel enum value differences at load-time instead of compile-time.
Dropped the mm/memcontrol.c patch.
Modified test_kmem handling: instead of skipping when nokmem is set, verify that kmem value is zero as expected.
According to the comments of bot, fixed assertion message: changed "bpf_mem_cgroup_page_state" to "bpf_mem_cgroup_vm_events" for PGFAULT check.

Hui Zhu (2):
selftests/bpf: Remove kmem subtest from cgroup_iter_memcg
bpf: Use bpf_core_enum_value for stats in cgroup_iter_memcg

 .../testing/selftests/bpf/cgroup_iter_memcg.h |  2 --
 .../bpf/prog_tests/cgroup_iter_memcg.c        | 28 -------------------
 .../selftests/bpf/progs/cgroup_iter_memcg.c   | 18 ++++++++----
 3 files changed, 12 insertions(+), 36 deletions(-)
Signature · 1 line
2.43.0