Re: [PATCH v2 1/4] sched/fair: expose cpu.max.runtime to set bandwidth runtime directly
From: bot+bpf-ci
Date: Wed Nov 11 2026 - 03:33:29 EST
> sched/fair: expose cpu.max.runtime to set bandwidth runtime directly
TL;DR: In fair.c, cpu.max.runtime may return stale leftover runtime (e.g.
50000) after a group is switched to "max" quota, while writes fail; a
behaviour question about returning 0 or failing the read.
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
[ ... ]
> +u64 cfs_bandwidth_get_runtime(struct cfs_bandwidth *cfs_b)
> +{
> + u64 runtime;
> +
> + guard(raw_spinlock_irq)(&cfs_b->lock);
> +
> + runtime = cfs_b->runtime;
> + if (cfs_b->quota != RUNTIME_INF)
> + runtime = min(runtime, cfs_b->quota + cfs_b->burst);
> +
> + return runtime;
> +}
When the group is switched to "max", does cpu.max.runtime return a stale
value?
tg_set_cfs_bandwidth() calls __refill_cfs_bandwidth_runtime(), which
returns early when quota is RUNTIME_INF:
if (unlikely(cfs_b->quota == RUNTIME_INF))
return;
After that nothing updates cfs_b->runtime, so the value left over from
the last finite quota is returned uncapped here.
For example, write "50000 100000" to cpu.max, leave the group idle, then
write "max 100000". cpu.max.runtime keeps reading 50000 for as long as
the group is unlimited, while a group that never had a quota reads 0.
Writes fail with EINVAL in that state, but the read reports runtime the
group does not have and that is not being tracked.
Should this return a defined value (for example 0) when quota is
RUNTIME_INF, or fail the read the way the write fails?
This is documented as "The runtime the cgroup has accumulated and not
used yet", which has no meaning for an unconstrained group.
---
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