From: Peter Zijlstra <peterz@infradead.org>
To: Chao Yu <chao2.yu@samsung.com>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/fair: fix incorrect calculation of capacity in scale_rt_capacity
Date: Wed, 30 Sep 2015 18:18:34 +0200 [thread overview]
Message-ID: <20150930161834.GQ3604@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <011101d0f5c7$638b1260$2aa13720$@samsung.com>
On Wed, Sep 23, 2015 at 02:15:51PM +0800, Chao Yu wrote:
> div_u64 can only handle 32-bits divisor, if our divisor is with type of
> 64-bits, we should use div64_u64 instead, otherwise value of divisor will
> be cast to 32-bits, resulting in wrong calculation.
>
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
> kernel/sched/fair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 9176f7c..ee268ef 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6086,7 +6086,7 @@ static unsigned long scale_rt_capacity(int cpu)
>
> total = sched_avg_period() + delta;
>
> - used = div_u64(avg, total);
> + used = div64_u64(avg, total);
total here should not exceed 2*sched_avg_period() 'much', with the
defaults this would end up being around 1e9.
So unless you prod at sysctl_sched_time_avg it should all work out fine
with the 32bit divisor.
Have you seen problems here?
next prev parent reply other threads:[~2015-09-30 16:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 6:15 [PATCH] sched/fair: fix incorrect calculation of capacity in scale_rt_capacity Chao Yu
2015-09-30 16:18 ` Peter Zijlstra [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-09-29 1:41 Chao Yu
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=20150930161834.GQ3604@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=chao2.yu@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@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