Re: [PATCH] sched/rt: use u64 for RT group bandwidth accounting
From: Joseph Salisbury
Date: Fri Apr 03 2026 - 16:31:57 EST
Thanks for the feedback, Michal!
On 4/1/26 5:48 AM, Michal Koutný wrote:
Hi.You are right. This is mostly a correctness fix for a corner case. This patch primarily addresses the case where the arithmetic can silently truncate on 32-bit.
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 groupsAs per my calculation this'd require at least 4096 sibling 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.
(see to_ratio() and BW_SHIFT)...
In that case, an overcommitted hierarchy may incorrectly pass the...and I expect there'd other issues with so many so little RT groups
schedulability check.
than allowing theoretically unschedulabile configuration.
That's a good point. I can send a v2 that returns u64 from to_ratio() and keeps the RT totals in u64 as well.
Use u64 for the local bandwidth totals so the accumulated child sum andYou may want to fix this also in to_ratio() return type as there are
the parent limit are compared without 32-bit overflow.
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