]> git.baikalelectronics.ru Git - kernel.git/commit
sched/fair: Fix sgc->{min,max}_capacity calculation for SD_OVERLAP
authorPeng Liu <iwtbavbm@gmail.com>
Sat, 4 Jan 2020 13:08:28 +0000 (21:08 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 17 Jan 2020 09:19:21 +0000 (10:19 +0100)
commitb285098ce872ec38c41b6249224ab0ef91705b84
tree1eb64842ddea05c59a8cd95c081ee177160fe1a2
parent386876f21d0e6eacf5922f4ca53a931236b2f395
sched/fair: Fix sgc->{min,max}_capacity calculation for SD_OVERLAP

commit 62e268991246 ("sched/fair: Add per-CPU min capacity to
sched_group_capacity") introduced per-cpu min_capacity.

commit c95bba8166d0 ("sched/fair: Add sched_group per-CPU max capacity")
introduced per-cpu max_capacity.

In the SD_OVERLAP case, the local variable 'capacity' represents the sum
of CPU capacity of all CPUs in the first sched group (sg) of the sched
domain (sd).

It is erroneously used to calculate sg's min and max CPU capacity.
To fix this use capacity_of(cpu) instead of 'capacity'.

The code which achieves this via cpu_rq(cpu)->sd->groups->sgc->capacity
(for rq->sd != NULL) can be removed since it delivers the same value as
capacity_of(cpu) which is currently only used for the (!rq->sd) case
(see update_cpu_capacity()).
An sg of the lowest sd (rq->sd or sd->child == NULL) represents a single
CPU (and hence sg->sgc->capacity == capacity_of(cpu)).

Signed-off-by: Peng Liu <iwtbavbm@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lkml.kernel.org/r/20200104130828.GA7718@iZj6chx1xj0e0buvshuecpZ
kernel/sched/fair.c