From: bot+bpf-ci@kernel.org
To: sieberf@amazon.com,mingo@redhat.com,peterz@infradead.org,juri.lelli@redhat.com,vincent.guittot@linaro.org,tj@kernel.org
Cc: bsegall@google.com,dietmar.eggemann@arm.com,rostedt@goodmis.org,mgorman@suse.de,vschneid@redhat.com,kprateek.nayak@amd.com,hannes@cmpxchg.org,mkoutny@suse.com,void@manifault.com,arighi@nvidia.com,changwoo@igalia.com,skhan@linuxfoundation.org,corbet@lwn.net,rdunlap@infradead.org,cgroups@vger.kernel.org,sched-ext@lists.linux.dev,linux-doc@vger.kernel.org,linux-kselftest@vger.kernel.org,bpf@vger.kernel.org,linux-kernel@vger.kernel.org,nh-open-source@amazon.com,hborghor@amazon.de,fmubeen@amazon.de,dwmw@amazon.co.uk,karataev@amazon.com,sieberf@amazon.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH v2 3/4] sched_ext: add cgroup_set_runtime ops callback
Date: Wed, 11 Nov 2026 08:08:56 +0000 (UTC) [thread overview]
Message-ID: <ab530d93c7383ec9cd5d9fbedc531e933d4b812ddb367bb85c940b870d34c247@mail.kernel.org> (raw)
In-Reply-To: <a07b9717684d5e20d8ff7a778a5f031d1092f18a.1794303670.git.sieberf@amazon.com>
[-- Attachment #1: Type: text/plain, Size: 3194 bytes --]
> sched_ext: add cgroup_set_runtime ops callback
TL;DR: The documented guarantee that cgroup_set_runtime never exceeds the
quota the scheduler was last given may not hold for schedulers lacking
cgroup_init or cgroup_set_bandwidth; comment and commit message may need
qualifying, or validation tightened.
> diff --git a/kernel/sched/ext/internal.h b/kernel/sched/ext/internal.h
> --- a/kernel/sched/ext/internal.h
> +++ b/kernel/sched/ext/internal.h
[ ... ]
> @@ -863,6 +863,26 @@ struct sched_ext_ops {
> */
> void (*cgroup_set_idle)(struct cgroup *cgrp, bool idle);
>
> + /**
> + * @cgroup_set_runtime: A cgroup's runtime is being set
> + * @cgrp: cgroup whose runtime is being set
> + * @runtime_us: runtime in microseconds
[ ... ]
> + * @cgrp has a quota, and @runtime_us is at most the quota + burst the
> + * scheduler was last given, by @cgroup_init or @cgroup_set_bandwidth:
> + * cpu.max and cpu.max.runtime writes reach the scheduler in the order
> + * the fair class applied them.
> + *
> + * Delivery follows the same rule as cgroup_set_weight().
> + */
> + void (*cgroup_set_runtime)(struct cgroup *cgrp, u64 runtime_us);
Does this guarantee hold for a scheduler that implements
cgroup_set_runtime but not cgroup_init or cgroup_set_bandwidth? The
commit message makes the same claim: "The runtime passed is then at most
the quota + burst the scheduler was last given".
scx_group_set_bandwidth() still updates tg->scx.bw_* when the op is
missing:
if (scx_cgroup_enabled && sch && SCX_HAS_OP(sch, cgroup_set_bandwidth) && ...)
SCX_CALL_OP(sch, cgroup_set_bandwidth, ...);
tg->scx.bw_period_us = period_us;
tg->scx.bw_quota_us = quota_us;
tg->scx.bw_burst_us = burst_us;
while scx_group_set_runtime() calls the op whenever
SCX_HAS_OP(sch, cgroup_set_runtime) is true, and the fair class only
checks the runtime against its own cfs_b->quota + cfs_b->burst in
cfs_bandwidth_set_runtime().
For example, take a scheduler with cgroup_init and cgroup_set_runtime but
no cgroup_set_bandwidth. Cgroup C has cpu.max "10000 100000" at load, so
ops.cgroup_init() sees bw_quota_us=10000. Userspace then writes cpu.max
"50000 100000", which the fair class applies but the scheduler is never
told about. A following write of 40000 to cpu.max.runtime passes
cfs_bandwidth_set_runtime() since 40000 <= 50000, and
ops.cgroup_set_runtime(C, 40000) runs, four times the quota the scheduler
was last given.
Similarly, a scheduler without cgroup_init that loads after C's quota was
set is never given a quota, yet still receives cgroup_set_runtime for that
cgroup.
Should the comment (and commit message) make the guarantee conditional on
the scheduler implementing @cgroup_init and @cgroup_set_bandwidth, or
should validation reject cgroup_set_runtime without cgroup_set_bandwidth?
The later commit eb360e17b06e ("sched_ext: charge BPF scheduler tasks to
cpu.max bandwidth") does not change this text.
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/42982707042
next prev parent reply other threads:[~2026-11-11 8:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 11:08 [PATCH v2 0/4] sched/fair: cpu.max.runtime and idle refill for CPU credits Fernand Sieber
2026-11-10 11:08 ` [PATCH v2 1/4] sched/fair: expose cpu.max.runtime to set bandwidth runtime directly Fernand Sieber
2026-11-11 8:28 ` bot+bpf-ci
2026-11-10 11:08 ` [PATCH v2 2/4] sched/fair: refill bandwidth for the periods the timer slept through Fernand Sieber
2026-11-10 11:08 ` [PATCH v2 3/4] sched_ext: add cgroup_set_runtime ops callback Fernand Sieber
2026-11-11 8:08 ` bot+bpf-ci [this message]
2026-11-10 11:08 ` [PATCH v2 4/4] sched_ext: charge BPF scheduler tasks to cpu.max bandwidth Fernand Sieber
2026-11-11 8:28 ` bot+bpf-ci
2026-11-10 20:10 ` [PATCH v2 0/4] sched/fair: cpu.max.runtime and idle refill for CPU credits Tejun Heo
2026-11-11 12:20 ` Fernand Sieber
2026-11-11 17:26 ` Tejun Heo
2026-11-12 8:11 ` Fernand Sieber
2026-11-11 12:29 ` [PATCH v3 0/2] sched/fair: cpu.max.runtime and idle refill for a burstable budget Fernand Sieber
2026-11-11 12:29 ` [PATCH v3 1/2] sched/fair: expose cpu.max.runtime to set bandwidth runtime directly Fernand Sieber
2026-11-11 12:29 ` [PATCH v3 2/2] sched/fair: refill bandwidth for the periods the timer slept through Fernand Sieber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab530d93c7383ec9cd5d9fbedc531e933d4b812ddb367bb85c940b870d34c247@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=andrii@kernel.org \
--cc=arighi@nvidia.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=bsegall@google.com \
--cc=cgroups@vger.kernel.org \
--cc=changwoo@igalia.com \
--cc=corbet@lwn.net \
--cc=daniel@iogearbox.net \
--cc=dietmar.eggemann@arm.com \
--cc=dwmw@amazon.co.uk \
--cc=eddyz87@gmail.com \
--cc=fmubeen@amazon.de \
--cc=hannes@cmpxchg.org \
--cc=hborghor@amazon.de \
--cc=ihor.solodrai@linux.dev \
--cc=juri.lelli@redhat.com \
--cc=karataev@amazon.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=mason@kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=nh-open-source@amazon.com \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sched-ext@lists.linux.dev \
--cc=sieberf@amazon.com \
--cc=skhan@linuxfoundation.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=void@manifault.com \
--cc=vschneid@redhat.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®