From: Chao Yu <chao2.yu@samsung.com>
To: mingo@redhat.com, peterz@infradead.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] sched/fair: fix incorrect calculation of capacity in scale_rt_capacity
Date: Wed, 23 Sep 2015 14:15:51 +0800 [thread overview]
Message-ID: <011101d0f5c7$638b1260$2aa13720$@samsung.com> (raw)
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);
if (likely(used < SCHED_CAPACITY_SCALE))
return SCHED_CAPACITY_SCALE - used;
--
2.5.2
next reply other threads:[~2015-09-23 6:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 6:15 Chao Yu [this message]
2015-09-30 16:18 ` [PATCH] sched/fair: fix incorrect calculation of capacity in scale_rt_capacity Peter Zijlstra
-- 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='011101d0f5c7$638b1260$2aa13720$@samsung.com' \
--to=chao2.yu@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/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