Re: [PATCH 0/9] sched: Core scheduling interfaces

From: Peter Zijlstra
Date: Wed Apr 07 2021 - 14:41:12 EST


On Tue, Apr 06, 2021 at 12:08:50PM -0400, Tejun Heo wrote:

> I see. Yeah, if we really need it, I'm not sure it fits in cgroup interface
> proper. As I wrote elsewhere, these things are usually implemented on the
> originating subsystem interface with cgroup ID as a parameter.

This would be something like:

prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE_FROM, cgroup-fd, PIDTYPE_CGROUP, NULL);

right? Where we assign to self the cookie from the cgroup.

The problem I see with this is that a task can trivially undo/circumvent
this by calling PR_SCHED_CORE_CLEAR on itself, at which point it can
share with system tasks again.

Also, it doesn't really transfer well to the group/tasks thing. When a
task joins a cgroup, it doesn't automagically gain the cgroup
properties. Whoever does the transition will then also have to prctl()
this, which nobody will do.