All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: fix calc_cfs_shares fixed point arithmetics
@ 2016-12-19 22:40 Samuel Thibault
  2016-12-19 22:44 ` Paul Turner
  0 siblings, 1 reply; 12+ messages in thread
From: Samuel Thibault @ 2016-12-19 22:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: Peter Zijlstra, Thomas Gleixner, Ingo Molnar

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;
 

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-01-14 12:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-19 22:40 [PATCH] sched/fair: fix calc_cfs_shares fixed point arithmetics Samuel Thibault
2016-12-19 22:44 ` Paul Turner
2016-12-19 23:07   ` Samuel Thibault
2016-12-19 23:26     ` Paul Turner
2016-12-19 23:29       ` Samuel Thibault
2016-12-19 23:32         ` Paul Turner
2016-12-19 23:45           ` Samuel Thibault
2016-12-20 13:04             ` Dietmar Eggemann
2016-12-20 13:15               ` Peter Zijlstra
2017-01-11 11:29                 ` Dietmar Eggemann
2017-01-14 12:48                   ` [tip:sched/core] sched/fair: Explain why MIN_SHARES isn't scaled in calc_cfs_shares() tip-bot for Dietmar Eggemann
2016-12-20 13:22               ` [PATCH] sched/fair: fix calc_cfs_shares fixed point arithmetics Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.