Skip to content

Commit

Permalink
[PATCH] x86-64: Simplify the vector allocator.
Browse files Browse the repository at this point in the history
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: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Andi Kleen <ak@suse.de>
  • Loading branch information
Eric W. Biederman authored and Andi Kleen committed Oct 24, 2006
1 parent 7059abe commit d1752aa
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions arch/x86_64/kernel/io_apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* 0x80, because int 0x80 is hm, kind of importantish. ;)
*/
static struct {
int vector;
int offset;
} pos[NR_CPUS] = { [ 0 ... NR_CPUS - 1] = {FIRST_DEVICE_VECTOR, 0} };
static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
int old_vector = -1;
int cpu;

Expand All @@ -631,33 +628,30 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)

for_each_cpu_mask(cpu, mask) {
cpumask_t domain;
int first, new_cpu;
int new_cpu;
int vector, offset;

domain = vector_allocation_domain(cpu);
first = first_cpu(domain);

vector = pos[first].vector;
offset = pos[first].offset;
vector = current_vector;
offset = current_offset;
next:
vector += 8;
if (vector >= FIRST_SYSTEM_VECTOR) {
/* If we run out of vectors on large boxen, must share them. */
offset = (offset + 1) % 8;
vector = FIRST_DEVICE_VECTOR + offset;
}
if (unlikely(pos[first].vector == vector))
if (unlikely(current_vector == vector))
continue;
if (vector == IA32_SYSCALL_VECTOR)
goto next;
for_each_cpu_mask(new_cpu, domain)
if (per_cpu(vector_irq, new_cpu)[vector] != -1)
goto next;
/* Found one! */
for_each_cpu_mask(new_cpu, domain) {
pos[new_cpu].vector = vector;
pos[new_cpu].offset = offset;
}
current_vector = vector;
current_offset = offset;
if (old_vector >= 0) {
int old_cpu;
for_each_cpu_mask(old_cpu, irq_domain[irq])
Expand Down

0 comments on commit d1752aa

Please sign in to comment.