Re: [PATCH v2 1/3] sched/fair: Remove the write-order dependency between cpu.max and cpu.max.burst

From: Michal Koutný

Date: Mon Sep 07 2026 - 10:16:35 EST


On Fri, Sep 04, 2026 at 02:20:11PM +0800, Zhe Liu <liuzhe1@xxxxxxxxxx> wrote:
> 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.
>
> Fixes: f4183717b370 ("sched/fair: Introduce the burstable CFS controller")
>
> Cc: stable@xxxxxxxxxxxxxxx

The change makes sense to me and it should've been like that from the
beginning. OTOH, it may break someone's setup, so I'd take it but revert
it should regressions be reported. Hence, I wouldn't mark it for stable.


> Signed-off-by: Zhe Liu <liuzhe1@xxxxxxxxxx>
> ---
> 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;

I notice this'd be relaxed rather like:

if (burst_us > max_bw_runtime_us / 2)
return -EINVAL;

I don't see in the current code that these BW_SHIFT'd calculations were
relevant for burst.
(Sashiko mentions overflows of the addition but I think it's confused
MAX_BW and UULONG_MAX or more precisely (UULONG_MAX / NSEC_PER_USEC),)
so even your version should still be safe.

(Without that stable annotation above.)

Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx>

Attachment: signature.asc
Description: PGP signature