Re: [PATCH 00/11] cgroup: separate rstat trees

Yosry Ahmed
2025-02-24T21:54:44Z

On Mon, Feb 24, 2025 at 01:13:35PM -0800, Shakeel Butt wrote:
> On Thu, Feb 20, 2025 at 08:04:02PM +0000, Yosry Ahmed wrote:
> > On Thu, Feb 20, 2025 at 10:14:45AM -0800, JP Kobryn wrote:
> > > On 2/20/25 9:59 AM, Yosry Ahmed wrote:
> > > > On Thu, Feb 20, 2025 at 09:53:33AM -0800, Shakeel Butt wrote:
> > > > > On Thu, Feb 20, 2025 at 05:26:04PM +0000, Yosry Ahmed wrote:
> > > > > >
> > > > > > Another question is, does it make sense to keep BPF flushing in the
> > > > > > "self" css with base stats flushing for now? IIUC BPF flushing is not
> > > > > > very popular now anyway, and doing so will remove the need to support
> > > > > > flushing and updating things that are not css's. Just food for thought.
> > > > > >
> > > > >
> > > > > Oh if this simplifies the code, I would say go for it.
> > > >
> > > > I think we wouldn't need cgroup_rstat_ops and some of the refactoring
> > > > may not be needed. It will also reduce the memory overhead, and keep it
> > > > constant regardless of using BPF which is nice.
> > >
> > > Yes, this is true. cgroup_rstat_ops was only added to allow cgroup_bpf
> > > to make use of rstat. If the bpf flushing remains tied to
> > > cgroup_subsys_state::self, then the ops interface and supporting code
> > > can be removed. Probably stating the obvious but the trade-off would be
> > > that if bpf cgroups are in use, they would account for some extra
> > > overhead while flushing the base stats. Is Google making use of bpf-
> > > based cgroups?
> >
> > Ironically I don't know, but I don't expect the BPF flushing to be
> > expensive enough to affect this. If someone has the use case that loads
> > enough BPF programs to cause a noticeable impact, we can address it
> > then.
> >
> > This series will still be an improvement anyway.
>
> If no one is using the bpf+rstat infra then maybe we should rip it out.
> Do you have any concerns?

We did not end up using the BPF+rstat infra, so I have no objection over
removing that. They are kfuncs and supposedly there is no guarantee for
them hanging around.

However, looking back at the patch series [1], there were 3 main
components:
(a) cgroup_iter BPF programs support.
(b) kfunc hooks for BPF+rstat infra.
(c) Selftests.

I am not sure if there are other users for cgroup_iter for different
purposes than BPF+rstat, and I am not sure if we can remove an iterator
program type (in terms of stability).

We can drop the kfunc hooks, but they are not really a big deal imo. I
am fine either way.

If we remove (b) we can also remove the corresponding test, but not the
test for cgroup_iter as long as it stays.

[1]https://lore.kernel.org/all/20220824233117.1312810-1-haoluo@google.com/