Re: [PATCH bpf-next 1/3] selftests/bpf: Check bpf_mem_cgroup_page_state return value

From: hui . zhu

Date: Fri Feb 13 2026 - 02:29:51 EST


2026年2月13日 08:14, "JP Kobryn" <inwardvessel@xxxxxxxxx mailto:inwardvessel@xxxxxxxxx?to=%22JP%20Kobryn%22%20%3Cinwardvessel%40gmail.com%3E > 写到:


>
> 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.
>

I post v2 according to your comments.
Thanks for your review.

Best,
Hui