]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sched/deadline: Reset extra_bw to max_bw when clearing root domains
authorJuri Lelli <juri.lelli@redhat.com>
Fri, 27 Jun 2025 11:51:15 +0000 (13:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 14:38:46 +0000 (16:38 +0200)
[ Upstream commit fcc9276c4d331cd1fe9319d793e80b02e09727f5 ]

dl_clear_root_domain() doesn't take into account the fact that per-rq
extra_bw variables retain values computed before root domain changes,
resulting in broken accounting.

Fix it by resetting extra_bw to max_bw before restoring back dl-servers
contributions.

Fixes: 2ff899e351643 ("sched/deadline: Rebuild root domain accounting after every update")
Reported-by: Marcel Ziswiler <marcel.ziswiler@codethink.co.uk>
Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@codethink.co.uk> # nuc & rock5b
Link: https://lore.kernel.org/r/20250627115118.438797-3-juri.lelli@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/sched/deadline.c

index 89019a14082642760beed872ee31219d351e0ef9..65f3b2cc891da63acae2c971469220c8e6fbed76 100644 (file)
@@ -2976,7 +2976,14 @@ void dl_clear_root_domain(struct root_domain *rd)
        int i;
 
        guard(raw_spinlock_irqsave)(&rd->dl_bw.lock);
+
+       /*
+        * Reset total_bw to zero and extra_bw to max_bw so that next
+        * loop will add dl-servers contributions back properly,
+        */
        rd->dl_bw.total_bw = 0;
+       for_each_cpu(i, rd->span)
+               cpu_rq(i)->dl.extra_bw = cpu_rq(i)->dl.max_bw;
 
        /*
         * dl_servers are not tasks. Since dl_add_task_root_domain ignores