Hi, Zhe, 在 2026/9/4 14:20, Zhe Liu 写道: > Keep the configured burst independent of the current quota and cap it > when CFS refills runtime. This allows quota and burst updates in either > order. >
Ran the selftests on next-20260903 in a VM: all 10 test_cpu cases pass with the series applied, and test_cpucg_max_burst fails on the unpatched kernel, so the test does catch the old behavior. One problem (spotted by sashiko, an automated overflow checker; I re-did the arithmetic): dropping the burst_us + quota_us <= max_bw_runtime_us check is not safe. With quota and burst both near MAX_BW, the period-scaling path in sched_cfs_period_timer() can double both up to 512x, and the new clamp quota + min(burst, quota) in __refill_cfs_bandwidth_runtime() then wraps u64 to 0, leaving the group with zero runtime on every refill. I believe you can just drop the burst_us > quota_us comparison and keep the sum check. Both write-order cases still pass that way: burst=80ms with quota=50ms gives 130ms, well under the limit. Tested-by: Tao Cui <[email protected]> > Fixes: f4183717b370 ("sched/fair: Introduce the burstable CFS controller") > > Cc: [email protected] > Signed-off-by: Zhe Liu <[email protected]> > --- > kernel/sched/core.c | 3 +-- > kernel/sched/fair.c | 3 ++- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index f78275192036..5269b8cfcf7f 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -10159,8 +10159,7 @@ static int tg_set_bandwidth(struct task_group *tg, > if (quota_us != RUNTIME_INF && quota_us > max_bw_runtime_us) > return -EINVAL; > > - if (quota_us != RUNTIME_INF && (burst_us > quota_us || > - burst_us + quota_us > > max_bw_runtime_us)) > + if (burst_us > max_bw_runtime_us) > return -EINVAL; > > #ifdef CONFIG_CFS_BANDWIDTH > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 6d881e530f89..488de18d477e 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -6627,7 +6627,8 @@ void __refill_cfs_bandwidth_runtime(struct > cfs_bandwidth *cfs_b) > cfs_b->nr_burst++; > } > > - cfs_b->runtime = min(cfs_b->runtime, cfs_b->quota + cfs_b->burst); > + cfs_b->runtime = min(cfs_b->runtime, > + cfs_b->quota + min(cfs_b->burst, cfs_b->quota)); > cfs_b->runtime_snap = cfs_b->runtime; > } >

