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

Roman Gushchin
2025-10-29T20:26:14Z

Tejun Heo <tj@kernel.org> writes:

> Hello,
>
> On Mon, Oct 27, 2025 at 04:17:05PM -0700, Roman Gushchin wrote:
>> @@ -1849,6 +1849,7 @@ struct bpf_struct_ops_link {
>> struct bpf_link link;
>> struct bpf_map __rcu *map;
>> wait_queue_head_t wait_hup;
>> + u64 cgroup_id;
>> };
>
> BTW, for sched_ext sub-sched support, I'm just adding cgroup_id to
> struct_ops, which seems to work fine. It'd be nice to align on the same
> approach. What are the benefits of doing this through fd?

Then you can attach a single struct ops to multiple cgroups (or Idk
sockets or processes or some other objects in the future).
And IMO it's just a more generic solution.

Thanks!