Hi, This is a rewrite of the core sched interface bits, and mostly replaces patches 2-5 from this set here:
https://lkml.kernel.org/r/20210324214020.34142-1-j...@joelfernandes.org The task interface is extended to include PR_SCHED_CORE_GET, because the selftest. Otherwise the task interface is much the same, except completely new code. The cgroup interface now uses a 'core_sched' file, which still takes 0,1. It is however changed such that you can have nested tags. The for any given task, the first parent with a cookie is the effective one. The rationale is that this way you can delegate subtrees and still allow them some control over grouping. The cgroup thing also '(ab)uses' cgroup_mutex for serialization because it needs to ensure continuity between ss->can_attach() and ss->attach() for the memory allocation. If the prctl() were allowed to interleave it might steal the memory. Using cgroup_mutex feels icky, but is not without precedent, kernel/bpf/cgroup.c does the same thing afaict. TJ, can you please have a look at this? The last patch implements the prctl() / cgroup interaction, up until that point each task carries the cookie set last between either interface, which is not desirable. It really isn't the nicest thing ever, but it does keep the scheduling core from having to consider multiple cookies. Also, I still hate the kernel/sched/core_sched.c filename, but short of using gibberish names to make tab-completion easier I simply cannot come up with a remotely sane alternative :/ The code seems to not insta crash, and I can run the prctl() selftest while in a cgroup and have it pass, not leak any references etc.. But it's otherwise lightly tested code. Please read carefully etc.. Also of note; I didn't seem to need the css_offline and css_exit handlers the other set added. FWIW, I have a 4 day weekend ahead :-)