Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched/deadline: Reset extra_bw to max_bw when clearing root domains

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

authored by

Juri Lelli and committed by
Peter Zijlstra
fcc9276c 9f239df5

+7
+7
kernel/sched/deadline.c
··· 2924 2924 int i; 2925 2925 2926 2926 guard(raw_spinlock_irqsave)(&rd->dl_bw.lock); 2927 + 2928 + /* 2929 + * Reset total_bw to zero and extra_bw to max_bw so that next 2930 + * loop will add dl-servers contributions back properly, 2931 + */ 2927 2932 rd->dl_bw.total_bw = 0; 2933 + for_each_cpu(i, rd->span) 2934 + cpu_rq(i)->dl.extra_bw = cpu_rq(i)->dl.max_bw; 2928 2935 2929 2936 /* 2930 2937 * dl_servers are not tasks. Since dl_add_task_root_domain ignores