Skip to content

Commit b90f7c9

Browse files
vingu-linaroIngo Molnar
authored andcommitted
sched/pelt: Fix update of blocked PELT ordering
update_cfs_rq_load_avg() can call cpufreq_update_util() to trigger an update of the frequency. Make sure that RT, DL and IRQ PELT signals have been updated before calling cpufreq. Signed-off-by: Vincent Guittot <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Fixes: 371bf42 ("sched/rt: Add rt_rq utilization tracking") Fixes: 3727e0e ("sched/dl: Add dl_rq utilization tracking") Fixes: 91c2749 ("sched/irq: Add IRQ utilization tracking") Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent ff51ff8 commit b90f7c9

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

kernel/sched/fair.c

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7547,6 +7547,19 @@ static void update_blocked_averages(int cpu)
75477547
rq_lock_irqsave(rq, &rf);
75487548
update_rq_clock(rq);
75497549

7550+
/*
7551+
* update_cfs_rq_load_avg() can call cpufreq_update_util(). Make sure
7552+
* that RT, DL and IRQ signals have been updated before updating CFS.
7553+
*/
7554+
curr_class = rq->curr->sched_class;
7555+
update_rt_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &rt_sched_class);
7556+
update_dl_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &dl_sched_class);
7557+
update_irq_load_avg(rq, 0);
7558+
7559+
/* Don't need periodic decay once load/util_avg are null */
7560+
if (others_have_blocked(rq))
7561+
done = false;
7562+
75507563
/*
75517564
* Iterates the task_group tree in a bottom up fashion, see
75527565
* list_add_leaf_cfs_rq() for details.
@@ -7574,14 +7587,6 @@ static void update_blocked_averages(int cpu)
75747587
done = false;
75757588
}
75767589

7577-
curr_class = rq->curr->sched_class;
7578-
update_rt_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &rt_sched_class);
7579-
update_dl_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &dl_sched_class);
7580-
update_irq_load_avg(rq, 0);
7581-
/* Don't need periodic decay once load/util_avg are null */
7582-
if (others_have_blocked(rq))
7583-
done = false;
7584-
75857590
update_blocked_load_status(rq, !done);
75867591
rq_unlock_irqrestore(rq, &rf);
75877592
}
@@ -7642,12 +7647,18 @@ static inline void update_blocked_averages(int cpu)
76427647

76437648
rq_lock_irqsave(rq, &rf);
76447649
update_rq_clock(rq);
7645-
update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq);
76467650

7651+
/*
7652+
* update_cfs_rq_load_avg() can call cpufreq_update_util(). Make sure
7653+
* that RT, DL and IRQ signals have been updated before updating CFS.
7654+
*/
76477655
curr_class = rq->curr->sched_class;
76487656
update_rt_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &rt_sched_class);
76497657
update_dl_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &dl_sched_class);
76507658
update_irq_load_avg(rq, 0);
7659+
7660+
update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq);
7661+
76517662
update_blocked_load_status(rq, cfs_rq_has_blocked(cfs_rq) || others_have_blocked(rq));
76527663
rq_unlock_irqrestore(rq, &rf);
76537664
}

0 commit comments

Comments
 (0)