Re: [RFC PATCH bpf-next 8/9] bpf: Introduce cgroup iter
From: Hao Luo <hidden>
Date: 2022-05-10 18:25:33
Also in:
bpf, cgroups, lkml
On Mon, May 9, 2022 at 5:18 PM Yosry Ahmed [off-list ref] wrote:
From: Hao Luo <redacted> Introduce a new type of iter prog: cgroup. Unlike other bpf_iter, this iter doesn't iterate a set of kernel objects. Instead, it is supposed to be parameterized by a cgroup id and prints only that cgroup. So one needs to specify a target cgroup id when attaching this iter. The target cgroup's state can be read out via a link of this iter. Signed-off-by: Hao Luo <redacted> Signed-off-by: Yosry Ahmed <redacted> --- include/linux/bpf.h | 2 + include/uapi/linux/bpf.h | 6 ++ kernel/bpf/Makefile | 2 +- kernel/bpf/cgroup_iter.c | 148 +++++++++++++++++++++++++++++++++ tools/include/uapi/linux/bpf.h | 6 ++ 5 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 kernel/bpf/cgroup_iter.c
Thanks Yosry for posting this patch! Dear reviewers, this is v2 of the cgroup_iter change I sent previously at https://lore.kernel.org/bpf/20220225234339.2386398-9-haoluo@google.com/ (local) v1 - > v2: - Getting the cgroup's reference at the time at attaching, instead of at the time when iterating. (Yonghong) (context [1]) - Remove .init_seq_private and .fini_seq_private callbacks for cgroup_iter. They are not needed now. (Yonghong) [1] https://lore.kernel.org/bpf/f780fc3a-dbc2-986c-d5a0-6b0ef1c4311f@fb.com/ (local) Hao