Re: [PATCH v2 02/23] bpf: initial support for attaching struct ops to cgroups

Tejun Heo
2025-10-29T22:53:25Z

Hello,

On Wed, Oct 29, 2025 at 03:43:39PM -0700, Alexei Starovoitov wrote:
...
> I think the general bpf philosophy that load and attach are two
> separate steps. For struct-ops it's almost there, but not quite.
> struct-ops shouldn't be an exception.
> The bpf infra should be able to load a set of progs (aka struct-ops)
> and attach it with a link to different entities. Like cgroups.
> I think sched-ext should do that too. Even if there is no use case
> today for the same sched-ext in two different cgroups.

I'm not sure it's just that there's no use case.

- How would recursion work with private stacks? Aren't those attached to
each BPF program?

- Wouldn't that also complicate attributing kfunc calls to the handle
instance? If there is one struct_ops per cgroup, the oom kill kfunc can
look that up and then verify that the struct_ops has authority over the
target process. Multiple attachments can work too but that'd require
iterating all attachments, right?

Thanks.

--
tejun