bpf: Add bpf_task_under_cgroup() kfunc
authorFeng Zhou <zhoufeng.zf@bytedance.com>
Sat, 6 May 2023 03:15:44 +0000 (11:15 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 6 May 2023 20:56:38 +0000 (13:56 -0700)
commitb5ad4cdc46c7d6e7f8d2c9e24b6c9a1edec95154
treeda5fd807709df253d71fc116187f4de1f6788217
parentf4dea9689c5fea3d07170c2cb0703e216f1a0922
bpf: Add bpf_task_under_cgroup() kfunc

Add a kfunc that's similar to the bpf_current_task_under_cgroup.
The difference is that it is a designated task.

When hook sched related functions, sometimes it is necessary to
specify a task instead of the current task.

Signed-off-by: Feng Zhou <zhoufeng.zf@bytedance.com>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20230506031545.35991-2-zhoufeng.zf@bytedance.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/helpers.c