Skip to content

Commit 147d867

Browse files
committed
sched/deadline: Fix accounting after global limits change
JIRA: https://issues.redhat.com/browse/RHEL-105980 commit 440989c Author: Juri Lelli <juri.lelli@redhat.com> Date: Fri Jun 27 13:51:16 2025 +0200 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 Signed-off-by: Phil Auld <pauld@redhat.com>
1 parent e75be7a commit 147d867

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

kernel/sched/deadline.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3282,6 +3282,9 @@ void sched_dl_do_global(void)
32823282
if (global_rt_runtime() != RUNTIME_INF)
32833283
new_bw = to_ratio(global_rt_period(), global_rt_runtime());
32843284

3285+
for_each_possible_cpu(cpu)
3286+
init_dl_rq_bw_ratio(&cpu_rq(cpu)->dl);
3287+
32853288
for_each_possible_cpu(cpu) {
32863289
rcu_read_lock_sched();
32873290

@@ -3297,7 +3300,6 @@ void sched_dl_do_global(void)
32973300
raw_spin_unlock_irqrestore(&dl_b->lock, flags);
32983301

32993302
rcu_read_unlock_sched();
3300-
init_dl_rq_bw_ratio(&cpu_rq(cpu)->dl);
33013303
}
33023304
}
33033305

kernel/sched/rt.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2938,6 +2938,12 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
29382938
sched_domains_mutex_unlock();
29392939
mutex_unlock(&mutex);
29402940

2941+
/*
2942+
* After changing maximum available bandwidth for DEADLINE, we need to
2943+
* recompute per root domain and per cpus variables accordingly.
2944+
*/
2945+
rebuild_sched_domains();
2946+
29412947
return ret;
29422948
}
29432949

0 commit comments

Comments
 (0)