public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Yuyang Du <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: a.ryabinin@samsung.com, davej@redhat.com, mingo@kernel.org,
	peterz@infradead.org, hpa@zytor.com, sasha.levin@oracle.com,
	yuyang.du@intel.com, torvalds@linux-foundation.org,
	linux-kernel@vger.kernel.org, tglx@linutronix.de
Subject: [tip:sched/urgent] sched: Fix odd values in effective_load() calculations
Date: Fri, 9 Jan 2015 04:33:25 -0800	[thread overview]
Message-ID: <tip-32a8df4e0b33fccc9715213b382160415b5c4008@git.kernel.org> (raw)
In-Reply-To: <20141219002956.GA25405@intel.com>

Commit-ID:  32a8df4e0b33fccc9715213b382160415b5c4008
Gitweb:     http://git.kernel.org/tip/32a8df4e0b33fccc9715213b382160415b5c4008
Author:     Yuyang Du <yuyang.du@intel.com>
AuthorDate: Fri, 19 Dec 2014 08:29:56 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 9 Jan 2015 11:18:54 +0100

sched: Fix odd values in effective_load() calculations

In effective_load, we have (long w * unsigned long tg->shares) / long W,
when w is negative, it is cast to unsigned long and hence the product is
insanely large. Fix this by casting tg->shares to long.

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Yuyang Du <yuyang.du@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dave Jones <davej@redhat.com>
Cc: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20141219002956.GA25405@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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 df2cdf7..6b99659 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4424,7 +4424,7 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg)
 		 * wl = S * s'_i; see (2)
 		 */
 		if (W > 0 && w < W)
-			wl = (w * tg->shares) / W;
+			wl = (w * (long)tg->shares) / W;
 		else
 			wl = tg->shares;
 

  parent reply	other threads:[~2015-01-09 12:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 22:53 sched: odd values for effective load calculations Sasha Levin
2014-12-13  8:30 ` Ingo Molnar
2014-12-15 12:12   ` Peter Zijlstra
2014-12-15 13:14     ` Peter Zijlstra
2014-12-16  5:29       ` Sasha Levin
2014-12-16 15:37         ` Peter Zijlstra
2014-12-18  2:10         ` Yuyang Du
2014-12-16  4:51     ` Sasha Levin
2014-12-16  2:09       ` Yuyang Du
2014-12-19  0:29         ` Yuyang Du
2014-12-19 11:20           ` Peter Zijlstra
2015-01-09 12:33           ` tip-bot for Yuyang Du [this message]
2014-12-16 15:33       ` Peter Zijlstra

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=tip-32a8df4e0b33fccc9715213b382160415b5c4008@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.ryabinin@samsung.com \
    --cc=davej@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sasha.levin@oracle.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=yuyang.du@intel.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