Commit 32a8df4e0b33fccc9715213b382160415b5c4008

Authored by Yuyang Du
Committed by Ingo Molnar
1 parent 536ebe9ca9

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -4424,7 +4424,7 @@
4424 4424 * wl = S * s'_i; see (2)
4425 4425 */
4426 4426 if (W > 0 && w < W)
4427   - wl = (w * tg->shares) / W;
  4427 + wl = (w * (long)tg->shares) / W;
4428 4428 else
4429 4429 wl = tg->shares;
4430 4430