Re: [PATCH v2] sched/fair: fix sgc->{min,max}_capacity miscalculate

From: Peter Zijlstra
Date: Mon Jan 06 2020 - 05:24:10 EST


On Sat, Jan 04, 2020 at 09:08:28PM +0800, Peng Liu wrote:
> commit bf475ce0a3dd ("sched/fair: Add per-CPU min capacity to
> sched_group_capacity") introduced per-cpu min_capacity.
>
> commit e3d6d0cb66f2 ("sched/fair: Add sched_group per-CPU max capacity")
> introduced per-cpu max_capacity.
>
> Here, capacity is the accumulated sum of (maybe) many CPUs' capacity.
> Compare with capacity to get {min,max}_capacity makes no sense. Instead,
> we should compare one by one in each iteration to get
> sgc->{min,max}_capacity of the group.
>
> Also, the only CPU in rq->sd->groups should be rq's CPU. Thus,
> capacity_of(cpu_of(rq)) should be equal to rq->sd->groups->sgc->capacity.
> Code can be simplified by removing the if/else.
>
> Signed-off-by: Peng Liu <iwtbavbm@xxxxxxxxx>
> Reviewed-by: Valentin Schneider <valentin.schneider@xxxxxxx>
> ---
> v1: https://lkml.org/lkml/2019/12/30/502

Please (for future use); use the form:

https://lkml.kernel.org/r/$msgid