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

sched/deadline: Fix accounting after global limits change

A global limits change (sched_rt_handler() logic) currently leaves stale
and/or incorrect values in variables related to accounting (e.g.
extra_bw).

Properly clean up per runqueue variables before implementing the change
and rebuild scheduling domains (so that accounting is also properly
restored) after such a change is complete.

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-4-juri.lelli@redhat.com

authored by

Juri Lelli and committed by
Peter Zijlstra
440989c1 fcc9276c

+9 -1
+3 -1
kernel/sched/deadline.c
··· 3183 3183 if (global_rt_runtime() != RUNTIME_INF) 3184 3184 new_bw = to_ratio(global_rt_period(), global_rt_runtime()); 3185 3185 3186 + for_each_possible_cpu(cpu) 3187 + init_dl_rq_bw_ratio(&cpu_rq(cpu)->dl); 3188 + 3186 3189 for_each_possible_cpu(cpu) { 3187 3190 rcu_read_lock_sched(); 3188 3191 ··· 3201 3198 raw_spin_unlock_irqrestore(&dl_b->lock, flags); 3202 3199 3203 3200 rcu_read_unlock_sched(); 3204 - init_dl_rq_bw_ratio(&cpu_rq(cpu)->dl); 3205 3201 } 3206 3202 } 3207 3203
+6
kernel/sched/rt.c
··· 2886 2886 sched_domains_mutex_unlock(); 2887 2887 mutex_unlock(&mutex); 2888 2888 2889 + /* 2890 + * After changing maximum available bandwidth for DEADLINE, we need to 2891 + * recompute per root domain and per cpus variables accordingly. 2892 + */ 2893 + rebuild_sched_domains(); 2894 + 2889 2895 return ret; 2890 2896 } 2891 2897