[PATCH] Choose CPU based on allocated IRQs
From: Long Li
Date: Mon Oct 22 2018 - 21:56:59 EST
From: Long Li <longli@xxxxxxxxxxxxx>
In irq_matrix, "available" is set when IRQs are allocated earlier in the IRQ
assigning process.
Later, when IRQs are activated those values are not good indicators of what
CPU to choose to assign to this IRQ.
Change to choose CPU for an IRQ based on how many IRQs are already allocated
on this CPU.
Signed-off-by: Long Li <longli@xxxxxxxxxxxxx>
---
kernel/irq/matrix.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/irq/matrix.c b/kernel/irq/matrix.c
index 6e6d467f3dec..a51689e3e7c0 100644
--- a/kernel/irq/matrix.c
+++ b/kernel/irq/matrix.c
@@ -128,7 +128,7 @@ static unsigned int matrix_alloc_area(struct irq_matrix *m, struct cpumap *cm,
static unsigned int matrix_find_best_cpu(struct irq_matrix *m,
const struct cpumask *msk)
{
- unsigned int cpu, best_cpu, maxavl = 0;
+ unsigned int cpu, best_cpu, min_allocated = UINT_MAX;
struct cpumap *cm;
best_cpu = UINT_MAX;
@@ -136,11 +136,11 @@ static unsigned int matrix_find_best_cpu(struct irq_matrix *m,
for_each_cpu(cpu, msk) {
cm = per_cpu_ptr(m->maps, cpu);
- if (!cm->online || cm->available <= maxavl)
+ if (!cm->online || cm->allocated > min_allocated)
continue;
best_cpu = cpu;
- maxavl = cm->available;
+ min_allocated = cm->allocated;
}
return best_cpu;
}
--
2.14.1