lkml.org 
[lkml]   [2016]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] sched/fair: fix calc_cfs_shares fixed point arithmetics
2159197d6677 ("sched/core: Enable increased load resolution on 64-bit kernels")

exposed yet another miscalculation in calc_cfs_shares: MIN_SHARES is unscaled,
and must thus be scaled before being manipulated against "shares" amounts.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Fixes: 2159197d6677 ("sched/core: Enable increased load resolution on 64-bit kernels")

---
This should be backported to 4.7 and 4.8 to fix scheduling priorities
miscalculations

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6559d19..be84f72 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2657,8 +2657,8 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg)
if (tg_weight)
shares /= tg_weight;

- if (shares < MIN_SHARES)
- shares = MIN_SHARES;
+ if (shares < scale_load(MIN_SHARES))
+ shares = scale_load(MIN_SHARES);
if (shares > tg->shares)
shares = tg->shares;

\
 
 \ /
  Last update: 2016-12-19 23:41    [W:0.107 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site