Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The new warning for unenforced `cpu.max` is missing during BPF scheduler initialization, meaning preexisting cgroup quotas are silently ignored without notification.
--
--- Patch [1]: [PATCH RFC] sched_ext: warn when cpu.max is set but the BPF scheduler doesn't implement bandwidth control ---
commit 88bd45e8c02c048f00992a1d03614c8ef709c738
Author: Tao Cui <[email protected]>
sched_ext: warn when cpu.max is set but the BPF scheduler doesn't implement bandwidth control
This commit adds a one-time warning when a finite cpu.max quota is
configured on a cgroup but the active BPF scheduler lacks the
cgroup_set_bandwidth callback. The intent is to notify users and
orchestrators that the quota is silently ignored and not enforced by the
scheduler.
> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index 18183062f751c..1067d271f6b27 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
> @@ -4565,6 +4565,12 @@ void scx_group_set_bandwidth(struct task_group *tg,
> tg->scx.bw_burst_us != burst_us))
> SCX_CALL_OP(sch, cgroup_set_bandwidth, NULL,
> tg_cgrp(tg), period_us, quota_us, burst_us);
> + else if (scx_cgroup_enabled && sch &&
> + !SCX_HAS_OP(sch, cgroup_set_bandwidth) &&
> + quota_us != RUNTIME_INF)
> + pr_warn_once("sched_ext: BPF scheduler \"%s\" does not implement "
> + "ops.cgroup_set_bandwidth(); cpu.max will not be enforced\n",
> + sch->ops.name);
[Severity: Medium]
Will this warning also catch preexisting cgroup bandwidth configurations?
If a user configures a finite cpu.max limit on a cgroup before the BPF
scheduler is loaded, the initialization path in scx_cgroup_init() passes
the existing quota to the scheduler:
kernel/sched/ext/ext.c:scx_cgroup_init() {
...
struct scx_cgroup_init_args args = {
.weight = tg->scx.weight,
.bw_period_us = tg->scx.bw_period_us,
.bw_quota_us = tg->scx.bw_quota_us,
.bw_burst_us = tg->scx.bw_burst_us,
};
...
ret = SCX_CALL_OP_RET(sch, cgroup_init, NULL,
css->cgroup, &args);
...
}
Should scx_cgroup_init() also check for an unenforced quota and emit this
warning, to ensure users are notified when preexisting configurations are
silently ignored?
>
> tg->scx.bw_period_us = period_us;
> tg->scx.bw_quota_us = quota_us;
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.