diff options
| author | Tejun Heo <tj@kernel.org> | 2026-04-29 21:09:11 +0300 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-04-29 21:25:07 +0300 |
| commit | 97f86c38abe62c911ff20bc3e00b0937842f79c0 (patch) | |
| tree | 43b107f6c0cb35ba9ccb7458f0c3ecca0152a30f | |
| parent | 5ea59a3af5abe142dc57691306caac03453cbb0a (diff) | |
| download | linux-97f86c38abe62c911ff20bc3e00b0937842f79c0.tar.xz | |
sched_ext: Require cid-form struct_ops for sub-sched support
Sub-scheduler support is tied to the cid-form struct_ops: sub_attach /
sub_detach will communicate allocation via cmask, and the hierarchy assumes
all participants share a single topological cid space. A cpu-form root that
accepts sub-scheds would need cpu <-> cid translation on every cross-sched
interaction, defeating the purpose.
Enforce this at validate_ops():
- A sub-scheduler (scx_parent(sch) non-NULL) must be cid-form.
- A root that exposes sub_attach / sub_detach must be cid-form.
scx_qmap, which is currently the only scheduler demoing sub-sched support,
was converted to cid-form in the preceding patch, so this doesn't cause
breakage.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Reviewed-by: Changwoo Min <changwoo@igalia.com>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
| -rw-r--r-- | kernel/sched/ext.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 65a00c979691..f3a585e32db3 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -6869,6 +6869,23 @@ static int validate_ops(struct scx_sched *sch, const struct sched_ext_ops *ops) if (!sch->is_cid_type && (ops->cpu_acquire || ops->cpu_release)) pr_warn("ops->cpu_acquire/release() are deprecated, use sched_switch TP instead\n"); + /* + * Sub-scheduler support is tied to the cid-form struct_ops. A sub-sched + * attaches through a cid-form-only interface (sub_attach/sub_detach), + * and a root that accepts sub-scheds must expose cid-form state to + * them. Reject cpu-form schedulers on either side. + */ + if (!sch->is_cid_type) { + if (scx_parent(sch)) { + scx_error(sch, "sub-sched requires cid-form struct_ops"); + return -EINVAL; + } + if (ops->sub_attach || ops->sub_detach) { + scx_error(sch, "sub_attach/sub_detach requires cid-form struct_ops"); + return -EINVAL; + } + } + return 0; } |
