Re: [PATCH] sched/rt: use u64 for RT group bandwidth accounting

From: Michal Koutný

Date: Wed Apr 01 2026 - 05:48:37 EST


Hi.

On Tue, Mar 17, 2026 at 03:34:02PM -0400, Joseph Salisbury <joseph.salisbury@xxxxxxxxxx> wrote:
> tg_rt_schedulable() sums the bandwidth ratios of all child RT groups
> and compares the result against the bandwidth available to the parent.
>
> On 32-bit builds, the running sum is stored in unsigned long and can
> overflow when enough child groups are present.

As per my calculation this'd require at least 4096 sibling RT groups
(see to_ratio() and BW_SHIFT)...

> In that case, an overcommitted hierarchy may incorrectly pass the
> schedulability check.

...and I expect there'd other issues with so many so little RT groups
than allowing theoretically unschedulabile configuration.

>
> Use u64 for the local bandwidth totals so the accumulated child sum and
> the parent limit are compared without 32-bit overflow.

You may want to fix this also in to_ratio() return type as there are
other consumers besides this check. (Although, some conditions would
still be similarly exotic, e.g. normalize_cfs_quota(), like CFQ quota of
more than 4096 (32b!) CPUs.)

Thanks,
Michal

Attachment: signature.asc
Description: PGP signature