sched/fair: Fix enqueue_task_fair warning
authorVincent Guittot <vincent.guittot@linaro.org>
Fri, 6 Mar 2020 13:52:57 +0000 (14:52 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 20 Mar 2020 12:06:18 +0000 (13:06 +0100)
commitfe61468b2cbc2b7ce5f8d3bf32ae5001d4c434e9
treee4b00d3efde65edd7f57a1f2115012f19830ebac
parent14533a16c46db70b8a75eda8fa633c25ac446d81
sched/fair: Fix enqueue_task_fair warning

When a cfs rq is throttled, the latter and its child are removed from the
leaf list but their nr_running is not changed which includes staying higher
than 1. When a task is enqueued in this throttled branch, the cfs rqs must
be added back in order to ensure correct ordering in the list but this can
only happens if nr_running == 1.
When cfs bandwidth is used, we call unconditionnaly list_add_leaf_cfs_rq()
when enqueuing an entity to make sure that the complete branch will be
added.

Similarly unthrottle_cfs_rq() can stop adding cfs in the list when a parent
is throttled. Iterate the remaining entity to ensure that the complete
branch will be added in the list.

Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: stable@vger.kernel.org
Cc: stable@vger.kernel.org #v5.1+
Link: https://lkml.kernel.org/r/20200306135257.25044-1-vincent.guittot@linaro.org
kernel/sched/fair.c