OSDN Git Service

UPSTREAM: sched/fair: Fix calc_cfs_shares() fixed point arithmetics width confusion
authorPeter Zijlstra <peterz@infradead.org>
Fri, 24 Jun 2016 14:11:02 +0000 (16:11 +0200)
committerAndres Oportus <andresoportus@google.com>
Fri, 2 Jun 2017 15:01:54 +0000 (08:01 -0700)
commitbaaa21b59be28c62746fd4f1465730bd42d1d5fc
treeef7d8a8101356794d896d4c42b459417b20111b9
parent20bbd92679ce1722c0b037b6eb49809a1c9cfd71
UPSTREAM: sched/fair: Fix calc_cfs_shares() fixed point arithmetics width confusion

Commit:

  fde7d22e01aa ("sched/fair: Fix overly small weight for interactive group entities")

did something non-obvious but also did it buggy yet latent.

The problem was exposed for real by a later commit in the v4.7 merge window:

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

... after which tg->load_avg and cfs_rq->load.weight had different
units (10 bit fixed point and 20 bit fixed point resp.).

Add a comment to explain the use of cfs_rq->load.weight over the
'natural' cfs_rq->avg.load_avg and add scale_load_down() to correct
for the difference in unit.

Since this is (now, as per a previous commit) the only user of
calc_tg_weight(), collapse it.

The effects of this bug should be randomly inconsistent SMP-balancing
of cgroups workloads.

Change-Id: If1e565662ea163485edd94a12aef644d0e0dfe7a
Reported-by: Jirka Hladky <jhladky@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 2159197d6677 ("sched/core: Enable increased load resolution on 64-bit kernels")
Fixes: fde7d22e01aa ("sched/fair: Fix overly small weight for interactive group entities")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit ea1dc6fc6242f991656e35e2ed3d90ec1cd13418)
Signed-off-by: Chris Redpath <chris.redpath@arm.com>
kernel/sched/fair.c