From: Joseph Salisbury <joseph.salisbury@oracle.com>
To: "Michal Koutný" <mkoutny@suse.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/rt: use u64 for RT group bandwidth accounting
Date: Fri, 3 Apr 2026 16:29:41 -0400 [thread overview]
Message-ID: <9e84b94e-b33c-4b49-88f8-6e88ef9e102d@oracle.com> (raw)
In-Reply-To: <sxddo56vlz7hsgvurqahszhrautpjgcmn3h3tst2ntxml23xlc@azmdbidza3vh>
Thanks for the feedback, Michal!
On 4/1/26 5:48 AM, Michal Koutný wrote:
> Hi.
>
> On Tue, Mar 17, 2026 at 03:34:02PM -0400, Joseph Salisbury <joseph.salisbury@oracle.com> 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.
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.
>
>> 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
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.
prev parent reply other threads:[~2026-04-03 20:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 19:34 Joseph Salisbury
2026-04-01 9:48 ` Michal Koutný
2026-04-03 20:29 ` Joseph Salisbury [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9e84b94e-b33c-4b49-88f8-6e88ef9e102d@oracle.com \
--to=joseph.salisbury@oracle.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®