Skip to content

bpf: Expand bpf_cgrp_storage to support cgroup1 non-attach case

Yafang Shao bpf cgroups 1 version Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyApplied 3/3

Changes from the cover letter

- RFC -> v1:
- Collect acked-by
- Avoid unnecessary is_cgroup1 check (Yonghong)
- Keep the code patterns consistent (Yonghong)

Patches in v1 All 3 applied

#Subject and filesSizeRepliesApplied
1/3bpf: Enable bpf_cgrp_storage for cgroup1 non-attach casekernel/bpf/bpf_cgrp_storage.c+3 -30 repliesApplied
2/3selftests/bpf: Add a new cgroup helper open_classid()tools/testing/selftests/bpf/cgroup_helpers.c tools/testing/selftests/bpf/cgroup_helpers.h+17 -00 repliesApplied
3/3selftests/bpf: Add selftests for cgroup1 local storagetools/testing/selftests/bpf/prog_tests/cgrp_local_storage.c tools/testing/selftests/bpf/progs/cgrp_ls_recursion.c tools/testing/selftests/bpf/progs/cgrp_ls_sleepable.c +1 more+278 -471 replyApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchTejun HeoYonghong Song
1/3A-b A-b
2/3A-b A-b
3/3A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH bpf-next 0/3] bpf: Expand bpf_cgrp_storage to support cgroup1 non-attach case

In the current cgroup1 environment, associating operations between a cgroup and applications in a BPF program requires storing a mapping of cgroup_id to application either in a hash map or maintaining it in userspace. However, by enabling bpf_cgrp_storage for cgroup1, it becomes possible to conveniently store application-specific information in cgroup-local storage and utilize it within BPF programs. Furthermore, enabling this feature for cgroup1 involves minor modifications for the non-attach case, streamlining the process.

However, when it comes to enabling this functionality for the cgroup1 attach case, it presents challenges. Therefore, the decision is to focus on enabling it solely for the cgroup1 non-attach case at present. If attempting to attach to a cgroup1 fd, the operation will simply fail with the error code -EBADF.

Changes:
- RFC -> v1:
- Collect acked-by
- Avoid unnecessary is_cgroup1 check (Yonghong)
- Keep the code patterns consistent (Yonghong)

Yafang Shao (3):
bpf: Enable bpf_cgrp_storage for cgroup1 non-attach case selftests/bpf: Add a new cgroup helper open_classid() selftests/bpf: Add selftests for cgroup1 local storage

 kernel/bpf/bpf_cgrp_storage.c                      |  6 +-
 tools/testing/selftests/bpf/cgroup_helpers.c       | 16 ++++
 tools/testing/selftests/bpf/cgroup_helpers.h       |  1 +
 .../selftests/bpf/prog_tests/cgrp_local_storage.c  | 98 +++++++++++++++++++++-
 .../selftests/bpf/progs/cgrp_ls_recursion.c        | 84 +++++++++++++++----
 .../selftests/bpf/progs/cgrp_ls_sleepable.c        | 61 ++++++++++++--
 tools/testing/selftests/bpf/progs/cgrp_ls_tp_btf.c | 82 +++++++++++++-----
 7 files changed, 298 insertions(+), 50 deletions(-)
Signature · 1 line
1.8.3.1