sched: Use cpu_dying() to fix balance_push vs hotplug-rollback
authorPeter Zijlstra <peterz@infradead.org>
Thu, 21 Jan 2021 15:09:32 +0000 (16:09 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 16 Apr 2021 15:06:32 +0000 (17:06 +0200)
commitb5c4477366fb5e6a2f0f38742c33acd666c07698
treebd7fa4cb0d72be06c611009cd76d94ce85142eeb
parente40f74c535b8a0ecf3ef0388b51a34cdadb34fb5
sched: Use cpu_dying() to fix balance_push vs hotplug-rollback

Use the new cpu_dying() state to simplify and fix the balance_push()
vs CPU hotplug rollback state.

Specifically, we currently rely on notifiers sched_cpu_dying() /
sched_cpu_activate() to terminate balance_push, however if the
cpu_down() fails when we're past sched_cpu_deactivate(), it should
terminate balance_push at that point and not wait until we hit
sched_cpu_activate().

Similarly, when cpu_up() fails and we're going back down, balance_push
should be active, where it currently is not.

So instead, make sure balance_push is enabled below SCHED_AP_ACTIVE
(when !cpu_active()), and gate it's utility with cpu_dying().

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lkml.kernel.org/r/YHgAYef83VQhKdC2@hirez.programming.kicks-ass.net
kernel/sched/core.c
kernel/sched/sched.h