Skip to content

Commit

Permalink
SBalance: Calculate the capacity of the CPU at it's current freq
Browse files Browse the repository at this point in the history
Most interrupts run relatively quickly and may finish execution before
the CPU can react and change its frequency.

Signed-off-by: Kazuki H <kazukih0205@gmail.com>
  • Loading branch information
Kaz205 committed Sep 21, 2023
1 parent 7ec276f commit b764a73
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions kernel/irq/sbalance.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,17 @@ static void balance_irqs(void)
goto unlock;

/*
* Get the current capacity for each CPU. This is adjusted for time
* spent processing IRQs, RT-task time, and thermal pressure. We don't
* exclude time spent processing IRQs when balancing because balancing
* is only done using interrupt counts rather than time spent in
* interrupts. That way, time spent processing each interrupt is
* considered when balancing.
* Get the current capacity for each CPU at it's current frequency.
* This is adjusted for time spent processing IRQs, RT-task time, and
* thermal pressure. We don't exclude time spent processing IRQs when
* balancing because balancing is only done using interrupt counts
* rather than time spent in interrupts. That way, time spent processing
* each interrupt is considered when balancing.
*/
for_each_cpu(cpu, &cpus)
per_cpu(cpu_cap, cpu) = cpu_rq(cpu)->cpu_capacity;
for_each_cpu(cpu, &cpus) {
per_cpu(cpu_cap, cpu) = cpu_rq(cpu)->cpu_capacity - arch_scale_cpu_capacity(cpu)
+ arch_scale_freq_capacity(cpu);
}

list_for_each_entry_rcu(bi, &bal_irq_list, node) {
if (!update_irq_data(bi, &cpu))
Expand Down

0 comments on commit b764a73

Please sign in to comment.