Commit d1752aa8 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Andi Kleen

[PATCH] x86-64: Simplify the vector allocator.

There is no reason to remember a per cpu position of which vector
to try.  Keeping a global position is simpler and more likely to
result in a global vector allocation even if I don't need or require
it.  For level triggered interrupts this means we are less likely to
acknowledge another cpus irq, and cause the level triggered irq to
harmlessly refire.

This simplification makes it easier to only access data structures
of  online cpus, by having fewer special cases to deal with.
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent 7059abed
...@@ -612,10 +612,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result) ...@@ -612,10 +612,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
* Also, we've got to be careful not to trash gate * Also, we've got to be careful not to trash gate
* 0x80, because int 0x80 is hm, kind of importantish. ;) * 0x80, because int 0x80 is hm, kind of importantish. ;)
*/ */
static struct { static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
int vector;
int offset;
} pos[NR_CPUS] = { [ 0 ... NR_CPUS - 1] = {FIRST_DEVICE_VECTOR, 0} };
int old_vector = -1; int old_vector = -1;
int cpu; int cpu;
...@@ -631,14 +628,13 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result) ...@@ -631,14 +628,13 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
for_each_cpu_mask(cpu, mask) { for_each_cpu_mask(cpu, mask) {
cpumask_t domain; cpumask_t domain;
int first, new_cpu; int new_cpu;
int vector, offset; int vector, offset;
domain = vector_allocation_domain(cpu); domain = vector_allocation_domain(cpu);
first = first_cpu(domain);
vector = pos[first].vector; vector = current_vector;
offset = pos[first].offset; offset = current_offset;
next: next:
vector += 8; vector += 8;
if (vector >= FIRST_SYSTEM_VECTOR) { if (vector >= FIRST_SYSTEM_VECTOR) {
...@@ -646,7 +642,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result) ...@@ -646,7 +642,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
offset = (offset + 1) % 8; offset = (offset + 1) % 8;
vector = FIRST_DEVICE_VECTOR + offset; vector = FIRST_DEVICE_VECTOR + offset;
} }
if (unlikely(pos[first].vector == vector)) if (unlikely(current_vector == vector))
continue; continue;
if (vector == IA32_SYSCALL_VECTOR) if (vector == IA32_SYSCALL_VECTOR)
goto next; goto next;
...@@ -654,10 +650,8 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result) ...@@ -654,10 +650,8 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
if (per_cpu(vector_irq, new_cpu)[vector] != -1) if (per_cpu(vector_irq, new_cpu)[vector] != -1)
goto next; goto next;
/* Found one! */ /* Found one! */
for_each_cpu_mask(new_cpu, domain) { current_vector = vector;
pos[new_cpu].vector = vector; current_offset = offset;
pos[new_cpu].offset = offset;
}
if (old_vector >= 0) { if (old_vector >= 0) {
int old_cpu; int old_cpu;
for_each_cpu_mask(old_cpu, irq_domain[irq]) for_each_cpu_mask(old_cpu, irq_domain[irq])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment