]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerIngo Molnar <mingo@kernel.org>
Mon, 27 Jun 2016 09:18:37 +0000 (11:18 +0200)
commit54847dacd0d6e5f89c0b05d3be2b55aa9c3d89a3
tree3a4091a59bdf94e432e1c0f7549b692e15e7e01f
parent34db71fe263aa7b5bdf0a682900d6e7512bd9402
sched/fair: Fix calc_cfs_shares() fixed point arithmetics width confusion

Commit:

  e2c94618ab50 ("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:

  e1d90ad09d29 ("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.

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: e1d90ad09d29 ("sched/core: Enable increased load resolution on 64-bit kernels")
Fixes: e2c94618ab50 ("sched/fair: Fix overly small weight for interactive group entities")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/fair.c