]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched: Use u64 for bandwidth ratio calculations
authorJoseph Salisbury <joseph.salisbury@oracle.com>
Fri, 3 Apr 2026 21:00:14 +0000 (17:00 -0400)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 7 Apr 2026 07:23:52 +0000 (09:23 +0200)
commitc6e80201e057dfb7253385e60bf541121bf5dc33
treee5c980379342d5c8a8a304abc39a602fdd566706
parent059258b0d424510202b6f2796279dbdbf0c6a83d
sched: Use u64 for bandwidth ratio calculations

to_ratio() computes BW_SHIFT-scaled bandwidth ratios from u64 period and
runtime values, but it returns unsigned long.  tg_rt_schedulable() also
stores the current group limit and the accumulated child sum in unsigned
long.

On 32-bit builds, large bandwidth ratios can be truncated and the RT
group sum can wrap when enough siblings are present.  That can let an
overcommitted RT hierarchy pass the schedulability check, and it also
narrows the helper result for other callers.

Return u64 from to_ratio() and use u64 for the RT group totals so
bandwidth ratios are preserved and compared at full width on both 32-bit
and 64-bit builds.

Fixes: b40b2e8eb521 ("sched: rt: multi level group constraints")
Assisted-by: Codex:GPT-5
Signed-off-by: Joseph Salisbury <joseph.salisbury@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260403210014.2713404-1-joseph.salisbury@oracle.com
kernel/sched/core.c
kernel/sched/rt.c
kernel/sched/sched.h