]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
sched/deadline: Check bandwidth overflow earlier for hotplug
authorJuri Lelli <juri.lelli@redhat.com>
Fri, 15 Nov 2024 11:48:29 +0000 (11:48 +0000)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 2 Dec 2024 11:01:31 +0000 (12:01 +0100)
commit53916d5fd3c0b658de3463439dd2b7ce765072cb
tree07ab01969714eb95b6730929d0933389d637f06e
parentd4742f6ed7ea6df56e381f82ba4532245fa1e561
sched/deadline: Check bandwidth overflow earlier for hotplug

Currently we check for bandwidth overflow potentially due to hotplug
operations at the end of sched_cpu_deactivate(), after the cpu going
offline has already been removed from scheduling, active_mask, etc.
This can create issues for DEADLINE tasks, as there is a substantial
race window between the start of sched_cpu_deactivate() and the moment
we possibly decide to roll-back the operation if dl_bw_deactivate()
returns failure in cpuset_cpu_inactive(). An example is a throttled
task that sees its replenishment timer firing while the cpu it was
previously running on is considered offline, but before
dl_bw_deactivate() had a chance to say no and roll-back happened.

Fix this by directly calling dl_bw_deactivate() first thing in
sched_cpu_deactivate() and do the required calculation in the former
function considering the cpu passed as an argument as offline already.

By doing so we also simplify sched_cpu_deactivate(), as there is no need
anymore for any kind of roll-back if we fail early.

Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Phil Auld <pauld@redhat.com>
Tested-by: Waiman Long <longman@redhat.com>
Link: https://lore.kernel.org/r/Zzc1DfPhbvqDDIJR@jlelli-thinkpadt14gen4.remote.csb
kernel/sched/core.c
kernel/sched/deadline.c