[PATCH bpf-next v3 0/3] Fix test_cgroup_iter_memcg issues found during back-porting

Hui Zhu posted 3 patches 1 month, 2 weeks ago
There is a newer version of this series
.../testing/selftests/bpf/cgroup_iter_memcg.h |  2 -
.../bpf/prog_tests/cgroup_iter_memcg.c        | 38 +++++--------------
.../selftests/bpf/progs/cgroup_iter_memcg.c   | 18 ++++++---
3 files changed, 22 insertions(+), 36 deletions(-)
[PATCH bpf-next v3 0/3] Fix test_cgroup_iter_memcg issues found during back-porting
Posted by Hui Zhu 1 month, 2 weeks ago
From: Hui Zhu <zhuhui@kylinos.cn>

While back-porting "mm: bpf kfuncs to access memcg data", I
encountered issues with test_cgroup_iter_memcg, specifically
in test_kmem.

These patches are my fixes for the problems I encountered.

Changelog:
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 (3):
  selftests/bpf: Remove kmem subtest from cgroup_iter_memcg
  bpf: Use bpf_core_enum_value for stats in cgroup_iter_memcg
  selftests/bpf: Check bpf_mem_cgroup_page_state return value

 .../testing/selftests/bpf/cgroup_iter_memcg.h |  2 -
 .../bpf/prog_tests/cgroup_iter_memcg.c        | 38 +++++--------------
 .../selftests/bpf/progs/cgroup_iter_memcg.c   | 18 ++++++---
 3 files changed, 22 insertions(+), 36 deletions(-)

-- 
2.43.0
Re: [PATCH bpf-next v3 0/3] Fix test_cgroup_iter_memcg issues found during back-porting
Posted by Emil Tsalapatis 1 month, 2 weeks ago
On Sat Feb 28, 2026 at 2:11 AM EST, Hui Zhu wrote:
> From: Hui Zhu <zhuhui@kylinos.cn>
>
> While back-porting "mm: bpf kfuncs to access memcg data", I
> encountered issues with test_cgroup_iter_memcg, specifically
> in test_kmem.
>
> These patches are my fixes for the problems I encountered.
>

Nit: Could you be a bit more descriptive about the series' contents?
Cover letters normally focus on what what the patch does - for example
the issues being found during backporting is not pertinent to the patchset 
itself, because the issues are still present on bpf-next.

> Changelog:
> 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 (3):
>   selftests/bpf: Remove kmem subtest from cgroup_iter_memcg
>   bpf: Use bpf_core_enum_value for stats in cgroup_iter_memcg
>   selftests/bpf: Check bpf_mem_cgroup_page_state return value
>
>  .../testing/selftests/bpf/cgroup_iter_memcg.h |  2 -
>  .../bpf/prog_tests/cgroup_iter_memcg.c        | 38 +++++--------------
>  .../selftests/bpf/progs/cgroup_iter_memcg.c   | 18 ++++++---
>  3 files changed, 22 insertions(+), 36 deletions(-)
Re: [PATCH bpf-next v3 0/3] Fix test_cgroup_iter_memcg issues found during back-porting
Posted by Emil Tsalapatis 1 month, 2 weeks ago
On Sat Feb 28, 2026 at 4:26 PM EST, Emil Tsalapatis wrote:
> On Sat Feb 28, 2026 at 2:11 AM EST, Hui Zhu wrote:
>> From: Hui Zhu <zhuhui@kylinos.cn>
>>
>> While back-porting "mm: bpf kfuncs to access memcg data", I
>> encountered issues with test_cgroup_iter_memcg, specifically
>> in test_kmem.
>>
>> These patches are my fixes for the problems I encountered.
>>
>
> Nit: Could you be a bit more descriptive about the series' contents?
> Cover letters normally focus on what what the patch does - for example
> the issues being found during backporting is not pertinent to the patchset 
> itself, because the issues are still present on bpf-next.
>

Also, responded on v3 instead of v4 sorry about that. Comments and
tags still apply since the only delta is in the commit message.

>> Changelog:
>> 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 (3):
>>   selftests/bpf: Remove kmem subtest from cgroup_iter_memcg
>>   bpf: Use bpf_core_enum_value for stats in cgroup_iter_memcg
>>   selftests/bpf: Check bpf_mem_cgroup_page_state return value
>>
>>  .../testing/selftests/bpf/cgroup_iter_memcg.h |  2 -
>>  .../bpf/prog_tests/cgroup_iter_memcg.c        | 38 +++++--------------
>>  .../selftests/bpf/progs/cgroup_iter_memcg.c   | 18 ++++++---
>>  3 files changed, 22 insertions(+), 36 deletions(-)