Re: [PATCH 4/9] sched: Default core-sched policy

From: Chris Hyser
Date: Wed Apr 21 2021 - 10:31:48 EST


On 4/21/21 9:33 AM, Peter Zijlstra wrote:
On Thu, Apr 01, 2021 at 03:10:16PM +0200, Peter Zijlstra wrote:
Implement default core scheduling policy.

- fork() / clone(): inherit cookie from parent
- exec(): if cookie then new cookie

Did that exec() thing want to change cookie on suid instead, just like
perf_event_exit_task() ?

Talk to me about that exec() thing; I still think it's weird. Did we
just want to drop cookie on suid instead?


The choices for fork and exec were for security. A forked process or thread gets a copy because the code is "trusted", but execed code is not by default (that was the policy choice) and so it gets a new cookie. Dropping the cookie on suid was not considered (an oversight on my part), but seems like a good idea, but I think, also orthogonal.

The biggest issue with a new cookie on exec is that makes it difficult to construct a large process tree of all the same cookies like the cgroup interface does. If we remove the cgroup interface, we either need to remove the "new cookie on exec" (inherit cookie from parent from fork) or provide a global/per-task policy for controlling that. Probably easiest to just drop it.

-chrish