BPF List
 help / color / mirror / Atom feed
* [RFC PATCH bpf-next 0/3] bpf: Expand bpf_cgrp_storage to support cgroup1 non-attach case
@ 2023-12-05 14:37 Yafang Shao
  2023-12-05 14:37 ` [RFC PATCH bpf-next 1/3] bpf: Enable bpf_cgrp_storage for " Yafang Shao
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Yafang Shao @ 2023-12-05 14:37 UTC (permalink / raw)
  To: ast, daniel, john.fastabend, andrii, martin.lau, song,
	yonghong.song, kpsingh, sdf, haoluo, jolsa, tj
  Cc: bpf, cgroups, Yafang Shao

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.

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  | 92 +++++++++++++++++++++-
 .../selftests/bpf/progs/cgrp_ls_recursion.c        | 84 ++++++++++++++++----
 .../selftests/bpf/progs/cgrp_ls_sleepable.c        | 67 ++++++++++++++--
 tools/testing/selftests/bpf/progs/cgrp_ls_tp_btf.c | 82 +++++++++++++------
 7 files changed, 298 insertions(+), 50 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-12-06  9:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-05 14:37 [RFC PATCH bpf-next 0/3] bpf: Expand bpf_cgrp_storage to support cgroup1 non-attach case Yafang Shao
2023-12-05 14:37 ` [RFC PATCH bpf-next 1/3] bpf: Enable bpf_cgrp_storage for " Yafang Shao
2023-12-06  4:17   ` Yonghong Song
2023-12-05 14:37 ` [RFC PATCH bpf-next 2/3] selftests/bpf: Add a new cgroup helper open_classid() Yafang Shao
2023-12-06  4:18   ` Yonghong Song
2023-12-05 14:37 ` [RFC PATCH bpf-next 3/3] selftests/bpf: Add selftests for cgroup1 local storage Yafang Shao
2023-12-06  4:24   ` Yonghong Song
2023-12-06  9:00     ` Yafang Shao
2023-12-05 17:15 ` [RFC PATCH bpf-next 0/3] bpf: Expand bpf_cgrp_storage to support cgroup1 non-attach case Tejun Heo
2023-12-06  2:47   ` Alexei Starovoitov
2023-12-06  3:01     ` Yafang Shao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox