cgroup: bpf: enable bpf programs to integrate with rstat
authorYosry Ahmed <yosryahmed@google.com>
Wed, 24 Aug 2022 23:31:15 +0000 (16:31 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 25 Aug 2022 18:35:37 +0000 (11:35 -0700)
commita319185be9f5ad13c2a296d448ac52ffe45d194c
treec3a4cd7169243259f429e8784236f602638d7230
parentfe0dd9d4b7402c9773fc7a453fa65875abaa24ec
cgroup: bpf: enable bpf programs to integrate with rstat

Enable bpf programs to make use of rstat to collect cgroup hierarchical
stats efficiently:
- Add cgroup_rstat_updated() kfunc, for bpf progs that collect stats.
- Add cgroup_rstat_flush() sleepable kfunc, for bpf progs that read stats.
- Add an empty bpf_rstat_flush() hook that is called during rstat
  flushing, for bpf progs that flush stats to attach to. Attaching a bpf
  prog to this hook effectively registers it as a flush callback.

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Hao Luo <haoluo@google.com>
Link: https://lore.kernel.org/r/20220824233117.1312810-4-haoluo@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/cgroup/rstat.c