Re: [PATCH v2 23/23] bpf: selftests: PSI struct ops test

Roman Gushchin
2025-11-11T19:03:25Z

Michal Hocko <mhocko@suse.com> writes:

> On Mon 27-10-25 16:22:06, Roman Gushchin wrote:
>> Add a PSI struct ops test.
>>
>> The test creates a cgroup with two child sub-cgroups, sets up
>> memory.high for one of those and puts there a memory hungry
>> process (initially frozen).
>>
>> Then it creates 2 PSI triggers from within a init() BPF callback and
>> attaches them to these cgroups. Then it deletes the first cgroup,
>> creates another one and runs the memory hungry task. From the cgroup
>> creation callback the test is creating another trigger.
>>
>> The memory hungry task is creating a high memory pressure in one
>> memory cgroup, which triggers a PSI event. The PSI BPF handler
>> declares a memcg oom in the corresponding cgroup. Finally the checks
>> that both handle_cgroup_free() and handle_psi_event() handlers were
>> executed, the correct process was killed and oom counters were
>> updated.
>
> I might be just dense but what is behind that deleted cgroup
> (deleted_cgroup_id etc) dance?

It was a way to test the handle_cgroup_free() callback, which might
go away in the next version. If it's gonna stay, I'll add more comments
around.

Thanks