mbox series

[bpf-next,0/4] Support storing struct cgroup * objects as kptrs

Message ID 20221122055458.173143-1-void@manifault.com (mailing list archive)
Headers show
Series Support storing struct cgroup * objects as kptrs | expand

Message

David Vernet Nov. 22, 2022, 5:54 a.m. UTC
In [0], we added support for storing struct task_struct * objects as
kptrs. This patch set extends this effort to also include storing struct
cgroup * object as kptrs.

As with tasks, there are many possible use cases for storing cgroups in
maps. During tracing, for example, it could be useful to query cgroup
statistics such as PSI averages, or tracking which tasks are migrating
to and from the cgroup.

[0]: https://lore.kernel.org/all/20221120051004.3605026-1-void@manifault.com/

David Vernet (4):
  bpf: Enable cgroups to be used as kptrs
  selftests/bpf: Add cgroup kfunc / kptr selftests
  bpf: Add bpf_cgroup_ancestor() kfunc
  selftests/bpf: Add selftests for bpf_cgroup_ancestor() kfunc

 kernel/bpf/helpers.c                          | 103 ++++++-
 tools/testing/selftests/bpf/DENYLIST.s390x    |   1 +
 .../selftests/bpf/prog_tests/cgrp_kfunc.c     | 175 ++++++++++++
 .../selftests/bpf/progs/cgrp_kfunc_common.h   |  72 +++++
 .../selftests/bpf/progs/cgrp_kfunc_failure.c  | 260 ++++++++++++++++++
 .../selftests/bpf/progs/cgrp_kfunc_success.c  | 170 ++++++++++++
 6 files changed, 778 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/cgrp_kfunc.c
 create mode 100644 tools/testing/selftests/bpf/progs/cgrp_kfunc_common.h
 create mode 100644 tools/testing/selftests/bpf/progs/cgrp_kfunc_failure.c
 create mode 100644 tools/testing/selftests/bpf/progs/cgrp_kfunc_success.c

Comments

Tejun Heo Nov. 22, 2022, 10:44 p.m. UTC | #1
On Mon, Nov 21, 2022 at 11:54:54PM -0600, David Vernet wrote:
> In [0], we added support for storing struct task_struct * objects as
> kptrs. This patch set extends this effort to also include storing struct
> cgroup * object as kptrs.
> 
> As with tasks, there are many possible use cases for storing cgroups in
> maps. During tracing, for example, it could be useful to query cgroup
> statistics such as PSI averages, or tracking which tasks are migrating
> to and from the cgroup.
> 
> [0]: https://lore.kernel.org/all/20221120051004.3605026-1-void@manifault.com/
> 
> David Vernet (4):
>   bpf: Enable cgroups to be used as kptrs
>   selftests/bpf: Add cgroup kfunc / kptr selftests
>   bpf: Add bpf_cgroup_ancestor() kfunc
>   selftests/bpf: Add selftests for bpf_cgroup_ancestor() kfunc

From cgroup POV:

 Acked-by: Tejun Heo <tj@kernel.org>

Thanks.
patchwork-bot+netdevbpf@kernel.org Nov. 22, 2022, 11 p.m. UTC | #2
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Mon, 21 Nov 2022 23:54:54 -0600 you wrote:
> In [0], we added support for storing struct task_struct * objects as
> kptrs. This patch set extends this effort to also include storing struct
> cgroup * object as kptrs.
> 
> As with tasks, there are many possible use cases for storing cgroups in
> maps. During tracing, for example, it could be useful to query cgroup
> statistics such as PSI averages, or tracking which tasks are migrating
> to and from the cgroup.
> 
> [...]

Here is the summary with links:
  - [bpf-next,1/4] bpf: Enable cgroups to be used as kptrs
    https://git.kernel.org/bpf/bpf-next/c/fda01efc6160
  - [bpf-next,2/4] selftests/bpf: Add cgroup kfunc / kptr selftests
    https://git.kernel.org/bpf/bpf-next/c/f583ddf15e57
  - [bpf-next,3/4] bpf: Add bpf_cgroup_ancestor() kfunc
    https://git.kernel.org/bpf/bpf-next/c/5ca786707829
  - [bpf-next,4/4] selftests/bpf: Add selftests for bpf_cgroup_ancestor() kfunc
    https://git.kernel.org/bpf/bpf-next/c/227a89cf5041

You are awesome, thank you!