From: Tim Chen <tim.c.chen@linux.intel.com>
To: "zhaowenhui (A)" <zhaowenhui8@huawei.com>,
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>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
"open list:SCHEDULER" <linux-kernel@vger.kernel.org>
Cc: zhangqiao22@huawei.com, tanghui20@huawei.com
Subject: Re: [BUG REPORT] sched/rt: Inaccurate numerical calculation in rt_runtime_us constraints
Date: Thu, 18 Jul 2024 12:42:37 -0700 [thread overview]
Message-ID: <ac08ae7b72eb7feb39d424ac7f56ce558c808d2b.camel@linux.intel.com> (raw)
In-Reply-To: <aa5f702d-30e3-77e2-084b-3a618204e9e8@huawei.com>
On Thu, 2024-07-18 at 21:02 +0800, zhaowenhui (A) wrote:
> Hello,
> Recently, we find that the cgroup rt_runtime_us's constraints is not
> precise enough in some cases. For example:
>
> (1)
> create a father cgroup and a child cgroup, and we exec:
> echo 1048577 > /sys/fs/cgroup/cpu/father/cpu.rt_period_us
> echo 1048577 > /sys/fs/cgroup/cpu/father/child/cpu.rt_period_us
> echo 0 > /sys/fs/cgroup/cpu/father/cpu.rt_runtime_us
> echo 1 > /sys/fs/cgroup/cpu/father/child/cpu.rt_runtime_us
>
> (2)
> create a father cgroup and two child cgroups, and we exec:
> echo 20000 > /sys/fs/cgroup/cpu/father/cpu.rt_runtime_us
> echo 10000 > /sys/fs/cgroup/cpu/father/child1/cpu.rt_runtime_us
> echo 10001 > /sys/fs/cgroup/cpu/father/child2/cpu.rt_runtime_us
> 1048577
> Logically speaking, the sum of child cgroups' rt_runtime_us should be
> less than the fater's rt_runtime_us, but actually both cases above would
> work. Because in to_ratio(), "div64_u64(runtime << BW_SHIFT, period)"
> ignores the remainders. So if the rt_period_us is big or many child
> cgroups' remainders are ignored, it could happen.
>
> But after all, it doesn't damage a lot, and seems not so easy to fix. So
> I report this and see what can we do about it.
The loss in precision is about 1/(1<<BW_SHIFT), roughly 1 part per million.
So unless you have tens of thousands of rt cgroups, over-allowing 1 part
per million bandwidth per cgroup is probably not a practical concern.
Is there an actual scenario you encountered where this becomes a problem?
Tim
>
> ---
> Regards
> Zhao Wenhui=
>
prev parent reply other threads:[~2024-07-18 19:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 13:02 zhaowenhui (A)
2024-07-18 19:42 ` Tim Chen [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=ac08ae7b72eb7feb39d424ac7f56ce558c808d2b.camel@linux.intel.com \
--to=tim.c.chen@linux.intel.com \
--cc=bristot@redhat.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=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tanghui20@huawei.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=zhangqiao22@huawei.com \
--cc=zhaowenhui8@huawei.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®