Re: [PATCH v2 07/23] mm: introduce bpf_oom_kill_process() bpf kfunc
From: Roman Gushchin
Date: Sun Nov 02 2025 - 16:10:14 EST
Michal Hocko <mhocko@xxxxxxxx> writes:
> On Mon 27-10-25 16:17:10, Roman Gushchin wrote:
>> Introduce bpf_oom_kill_process() bpf kfunc, which is supposed
>> to be used by BPF OOM programs. It allows to kill a process
>> in exactly the same way the OOM killer does: using the OOM reaper,
>> bumping corresponding memcg and global statistics, respecting
>> memory.oom.group etc.
>>
>> On success, it sets om_control's bpf_memory_freed field to true,
>> enabling the bpf program to bypass the kernel OOM killer.
>>
>> Signed-off-by: Roman Gushchin <roman.gushchin@xxxxxxxxx>
>
> LGTM
> Just a minor question
>
>> + /* paired with put_task_struct() in oom_kill_process() */
>> + task = tryget_task_struct(task);
>
> Any reason this is not a plain get_task_struct?
Fair enough, get_task_struct() should work too.
Thanks