sched/fair: Clean up active balance nr_balance_failed trickery
authorValentin Schneider <valentin.schneider@arm.com>
Wed, 7 Apr 2021 22:06:27 +0000 (23:06 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 9 Apr 2021 16:02:20 +0000 (18:02 +0200)
commit23fb06d9602b0fcfa1a16357a5d7a7f7076a39e2
tree0bc37392e963efb879485f353270c94c6d634d35
parent9bcb959d05eeb564dfc9cac13a59843a4fb2edf2
sched/fair: Clean up active balance nr_balance_failed trickery

When triggering an active load balance, sd->nr_balance_failed is set to
such a value that any further can_migrate_task() using said sd will ignore
the output of task_hot().

This behaviour makes sense, as active load balance intentionally preempts a
rq's running task to migrate it right away, but this asynchronous write is
a bit shoddy, as the stopper thread might run active_load_balance_cpu_stop
before the sd->nr_balance_failed write either becomes visible to the
stopper's CPU or even happens on the CPU that appended the stopper work.

Add a struct lb_env flag to denote active balancing, and use it in
can_migrate_task(). Remove the sd->nr_balance_failed write that served the
same purpose. Cleanup the LBF_DST_PINNED active balance special case.

Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210407220628.3798191-3-valentin.schneider@arm.com
kernel/sched/fair.c