summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2026-07-18 00:04:25 -1000
committerTejun Heo <tj@kernel.org>2026-07-19 21:11:04 -1000
commitb20dfde5ec543597f7f178f7b96cf6ebcc50e5ee (patch)
tree05756e9453f8f9736e370f37a9d16446e396f83a /kernel
parentd327796bd05d60500951edf5560a10bbff978d5b (diff)
sched_ext: Rename the cid-form cgroup ops to cpuctl_*
Two unrelated things go by "cgroup" in the cid form. Sub-schedulers attach to cgroups, and the cgroup_*() ops deliver cpu controller events. While the ops names suggest cgroup2 hierarchy, they actually operate on the cpu controller. Rename them to cpuctl_* in struct sched_ext_ops_cid, which has no users outside scx_qmap yet. The cpu form is deployed ABI and keeps the old names. The layout is unchanged and the kernel keeps calling through the cpu-form union view. Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Andrea Righi <arighi@nvidia.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/ext/ext.c36
-rw-r--r--kernel/sched/ext/internal.h25
2 files changed, 30 insertions, 31 deletions
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index 58cd971e5fc5..b730eac4b13f 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -7952,14 +7952,14 @@ static struct sched_ext_ops_cid __bpf_ops_sched_ext_ops_cid = {
.enable = sched_ext_ops__enable,
.disable = sched_ext_ops__disable,
#ifdef CONFIG_EXT_GROUP_SCHED
- .cgroup_init = sched_ext_ops__cgroup_init,
- .cgroup_exit = sched_ext_ops__cgroup_exit,
- .cgroup_prep_move = sched_ext_ops__cgroup_prep_move,
- .cgroup_move = sched_ext_ops__cgroup_move,
- .cgroup_cancel_move = sched_ext_ops__cgroup_cancel_move,
- .cgroup_set_weight = sched_ext_ops__cgroup_set_weight,
- .cgroup_set_bandwidth = sched_ext_ops__cgroup_set_bandwidth,
- .cgroup_set_idle = sched_ext_ops__cgroup_set_idle,
+ .cpuctl_init = sched_ext_ops__cgroup_init,
+ .cpuctl_exit = sched_ext_ops__cgroup_exit,
+ .cpuctl_prep_move = sched_ext_ops__cgroup_prep_move,
+ .cpuctl_move = sched_ext_ops__cgroup_move,
+ .cpuctl_cancel_move = sched_ext_ops__cgroup_cancel_move,
+ .cpuctl_set_weight = sched_ext_ops__cgroup_set_weight,
+ .cpuctl_set_bandwidth = sched_ext_ops__cgroup_set_bandwidth,
+ .cpuctl_set_idle = sched_ext_ops__cgroup_set_idle,
#endif
.sub_attach = sched_ext_ops__sub_attach,
.sub_detach = sched_ext_ops__sub_detach,
@@ -10479,22 +10479,22 @@ static int __init scx_init(void)
CID_OFFSET_MATCH(init_cids, init_cids);
CID_OFFSET_MATCH(init, init);
CID_OFFSET_MATCH(exit, exit);
-#ifdef CONFIG_EXT_GROUP_SCHED
- CID_OFFSET_MATCH(cgroup_init, cgroup_init);
- CID_OFFSET_MATCH(cgroup_exit, cgroup_exit);
- CID_OFFSET_MATCH(cgroup_prep_move, cgroup_prep_move);
- CID_OFFSET_MATCH(cgroup_move, cgroup_move);
- CID_OFFSET_MATCH(cgroup_cancel_move, cgroup_cancel_move);
- CID_OFFSET_MATCH(cgroup_set_weight, cgroup_set_weight);
- CID_OFFSET_MATCH(cgroup_set_bandwidth, cgroup_set_bandwidth);
- CID_OFFSET_MATCH(cgroup_set_idle, cgroup_set_idle);
-#endif
/* renamed callbacks must occupy the same slot as their cpu-form sibling */
CID_OFFSET_MATCH(select_cpu, select_cid);
CID_OFFSET_MATCH(set_cpumask, set_cmask);
CID_OFFSET_MATCH(cpu_online, cid_online);
CID_OFFSET_MATCH(cpu_offline, cid_offline);
CID_OFFSET_MATCH(dump_cpu, dump_cid);
+#ifdef CONFIG_EXT_GROUP_SCHED
+ CID_OFFSET_MATCH(cgroup_init, cpuctl_init);
+ CID_OFFSET_MATCH(cgroup_exit, cpuctl_exit);
+ CID_OFFSET_MATCH(cgroup_prep_move, cpuctl_prep_move);
+ CID_OFFSET_MATCH(cgroup_move, cpuctl_move);
+ CID_OFFSET_MATCH(cgroup_cancel_move, cpuctl_cancel_move);
+ CID_OFFSET_MATCH(cgroup_set_weight, cpuctl_set_weight);
+ CID_OFFSET_MATCH(cgroup_set_bandwidth, cpuctl_set_bandwidth);
+ CID_OFFSET_MATCH(cgroup_set_idle, cpuctl_set_idle);
+#endif
/* @priv tail must align since both share the same data block */
CID_OFFSET_MATCH(priv, priv);
/*
diff --git a/kernel/sched/ext/internal.h b/kernel/sched/ext/internal.h
index 0c0a8fdaa2c4..26bfda216524 100644
--- a/kernel/sched/ext/internal.h
+++ b/kernel/sched/ext/internal.h
@@ -992,6 +992,7 @@ struct sched_ext_ops {
* - cpu_online -> cid_online
* - cpu_offline -> cid_offline
* - dump_cpu -> dump_cid
+ * - cgroup_* -> cpuctl_* (they track the cgroup cpu controller)
* - cpu_acquire/cpu_release -> not present (deprecated in sched_ext_ops)
*
* BPF schedulers using this type cannot call cpu-form scx_bpf_* kfuncs;
@@ -1027,19 +1028,17 @@ struct sched_ext_ops_cid {
void (*dump_cid)(struct scx_dump_ctx *ctx, s32 cid, bool idle);
void (*dump_task)(struct scx_dump_ctx *ctx, struct task_struct *p);
#ifdef CONFIG_EXT_GROUP_SCHED
- s32 (*cgroup_init)(struct cgroup *cgrp,
- struct scx_cgroup_init_args *args);
- void (*cgroup_exit)(struct cgroup *cgrp);
- s32 (*cgroup_prep_move)(struct task_struct *p,
- struct cgroup *from, struct cgroup *to);
- void (*cgroup_move)(struct task_struct *p,
- struct cgroup *from, struct cgroup *to);
- void (*cgroup_cancel_move)(struct task_struct *p,
- struct cgroup *from, struct cgroup *to);
- void (*cgroup_set_weight)(struct cgroup *cgrp, u32 weight);
- void (*cgroup_set_bandwidth)(struct cgroup *cgrp,
- u64 period_us, u64 quota_us, u64 burst_us);
- void (*cgroup_set_idle)(struct cgroup *cgrp, bool idle);
+ s32 (*cpuctl_init)(struct cgroup *cgrp, struct scx_cgroup_init_args *args);
+ void (*cpuctl_exit)(struct cgroup *cgrp);
+ s32 (*cpuctl_prep_move)(struct task_struct *p, struct cgroup *from,
+ struct cgroup *to);
+ void (*cpuctl_move)(struct task_struct *p, struct cgroup *from, struct cgroup *to);
+ void (*cpuctl_cancel_move)(struct task_struct *p, struct cgroup *from,
+ struct cgroup *to);
+ void (*cpuctl_set_weight)(struct cgroup *cgrp, u32 weight);
+ void (*cpuctl_set_bandwidth)(struct cgroup *cgrp, u64 period_us, u64 quota_us,
+ u64 burst_us);
+ void (*cpuctl_set_idle)(struct cgroup *cgrp, bool idle);
#endif /* CONFIG_EXT_GROUP_SCHED */
s32 (*sub_attach)(struct scx_sub_attach_args *args);
void (*sub_detach)(struct scx_sub_detach_args *args);