Re: [PATCH bpf-next 1/3] selftests/bpf: Check bpf_mem_cgroup_page_state return value
From: JP Kobryn
Date: Thu Feb 12 2026 - 19:15:15 EST
On 2/12/26 12:23 AM, Hui Zhu wrote:
From: Hui Zhu <zhuhui@xxxxxxxxxx>
When back-porting test_progs to different kernel versions, I encountered
an issue where the test_cgroup_iter_memcg test would falsely pass even
when bpf_mem_cgroup_page_state() failed.
The problem occurs when test_progs compiled on one kernel version is
executed on another kernel with different enum values for memory
statistics (e.g., NR_ANON_MAPPED, NR_FILE_PAGES). [...]
This patch looks good but I think to fully solve this cross-kernel issue
we should use co-re in the bpf program. In your second revision, can you
add an additional patch to make use of bpf_core_enum_value()? This way
instead of relying on enum values in vmlinux.h at compile-time, we use
the btf info at load-time instead to get the proper value for the given
kernel.