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

Configure Feed

Select the types of activity you want to include in your feed.

sched/deadline: Restore dl_server bandwidth on non-destructive root domain changes

When root domain non-destructive changes (e.g., only modifying one of
the existing root domains while the rest is not touched) happen we still
need to clear DEADLINE bandwidth accounting so that it's then properly
restored, taking into account DEADLINE tasks associated to each cpuset
(associated to each root domain). After the introduction of dl_servers,
we fail to restore such servers contribution after non-destructive
changes (as they are only considered on destructive changes when
runqueues are attached to the new domains).

Fix this by making sure we iterate over the dl_servers attached to
domains that have not been destroyed and add their bandwidth
contribution back correctly.

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/20241114142810.794657-2-juri.lelli@redhat.com

authored by

Juri Lelli and committed by
Peter Zijlstra
41d4200b 59297e20

+19 -6
+14 -3
kernel/sched/deadline.c
··· 2960 2960 2961 2961 void dl_clear_root_domain(struct root_domain *rd) 2962 2962 { 2963 - unsigned long flags; 2963 + int i; 2964 2964 2965 - raw_spin_lock_irqsave(&rd->dl_bw.lock, flags); 2965 + guard(raw_spinlock_irqsave)(&rd->dl_bw.lock); 2966 2966 rd->dl_bw.total_bw = 0; 2967 - raw_spin_unlock_irqrestore(&rd->dl_bw.lock, flags); 2967 + 2968 + /* 2969 + * dl_server bandwidth is only restored when CPUs are attached to root 2970 + * domains (after domains are created or CPUs moved back to the 2971 + * default root doamin). 2972 + */ 2973 + for_each_cpu(i, rd->span) { 2974 + struct sched_dl_entity *dl_se = &cpu_rq(i)->fair_server; 2975 + 2976 + if (dl_server(dl_se) && cpu_active(i)) 2977 + rd->dl_bw.total_bw += dl_se->dl_bw; 2978 + } 2968 2979 } 2969 2980 2970 2981 #endif /* CONFIG_SMP */
+5 -3
kernel/sched/topology.c
··· 2721 2721 2722 2722 /* 2723 2723 * This domain won't be destroyed and as such 2724 - * its dl_bw->total_bw needs to be cleared. It 2725 - * will be recomputed in function 2726 - * update_tasks_root_domain(). 2724 + * its dl_bw->total_bw needs to be cleared. 2725 + * Tasks contribution will be then recomputed 2726 + * in function dl_update_tasks_root_domain(), 2727 + * dl_servers contribution in function 2728 + * dl_restore_server_root_domain(). 2727 2729 */ 2728 2730 rd = cpu_rq(cpumask_any(doms_cur[i]))->rd; 2729 2731 dl_clear_root_domain(rd);