cgroup: Prepare for using css_task_iter_*() in BPF
authorChuyi Zhou <zhouchuyi@bytedance.com>
Wed, 18 Oct 2023 06:17:39 +0000 (14:17 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 20 Oct 2023 00:02:46 +0000 (17:02 -0700)
commit6da88306811b40a207c94c9da9faf07bdb20776e
tree810c25824382b03274431b9670f419b2650af7ae
parent6bd5e167af2e9d1aa79e4a1a2598abcdc8fafd59
cgroup: Prepare for using css_task_iter_*() in BPF

This patch makes some preparations for using css_task_iter_*() in BPF
Program.

1. Flags CSS_TASK_ITER_* are #define-s and it's not easy for bpf prog to
use them. Convert them to enum so bpf prog can take them from vmlinux.h.

2. In the next patch we will add css_task_iter_*() in common kfuncs which
is not safe. Since css_task_iter_*() does spin_unlock_irq() which might
screw up irq flags depending on the context where bpf prog is running.
So we should use irqsave/irqrestore here and the switching is harmless.

Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20231018061746.111364-2-zhouchuyi@bytedance.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/cgroup.h
kernel/cgroup/cgroup.c