sched/fair: Fix fixed point arithmetic width for shares and effective load
authorDietmar Eggemann <dietmar.eggemann@arm.com>
Mon, 22 Aug 2016 14:00:41 +0000 (15:00 +0100)
committerIngo Molnar <mingo@kernel.org>
Fri, 30 Sep 2016 08:53:19 +0000 (10:53 +0200)
Since commit:

  2159197d6677 ("sched/core: Enable increased load resolution on 64-bit kernels")

we now have two different fixed point units for load:

- 'shares' in calc_cfs_shares() has 20 bit fixed point unit on 64-bit
  kernels. Therefore use scale_load() on MIN_SHARES.

- 'wl' in effective_load() has 10 bit fixed point unit. Therefore use
  scale_load_down() on tg->shares which has 20 bit fixed point unit on
  64-bit kernels.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1471874441-24701-1-git-send-email-dietmar.eggemann@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/fair.c

index 8fb4d1942c14fcafd833e3c92336849c3b0fff10..786ef94197e0b49be055a621d2e71fcf001aa76b 100644 (file)
@@ -5017,9 +5017,9 @@ 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 * (long)tg->shares) / W;
+                       wl = (w * (long)scale_load_down(tg->shares)) / W;
                else
-                       wl = tg->shares;
+                       wl = scale_load_down(tg->shares);
 
                /*
                 * Per the above, wl is the new se->load.weight value; since