add support for allowed_mask proposed kernel feature
git-svn-id: https://irqbalance.googlecode.com/svn/trunk@11 46b42954-3823-0410-bd82-eb80b452c9b5
This commit is contained in:
parent
927119952a
commit
1a90575154
28
irqlist.c
28
irqlist.c
|
@ -44,7 +44,7 @@ static void investigate(struct interrupt *irq, int number)
|
|||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
char *c, *c2;
|
||||
int nr;
|
||||
int nr , count = 0;
|
||||
char buf[PATH_MAX];
|
||||
sprintf(buf, "/proc/irq/%i", number);
|
||||
dir = opendir(buf);
|
||||
|
@ -68,6 +68,22 @@ static void investigate(struct interrupt *irq, int number)
|
|||
cpumask_parse_user(line, strlen(line), irq->mask);
|
||||
fclose(file);
|
||||
free(line);
|
||||
} else if (strcmp(entry->d_name,"allowed_affinity")==0) {
|
||||
char *line = NULL;
|
||||
size_t size = 0;
|
||||
FILE *file;
|
||||
sprintf(buf, "/proc/irq/%i/allowed_affinity", number);
|
||||
file = fopen(buf, "r");
|
||||
if (!file)
|
||||
continue;
|
||||
if (getline(&line, &size, file)==0) {
|
||||
free(line);
|
||||
fclose(file);
|
||||
continue;
|
||||
}
|
||||
cpumask_parse_user(line, strlen(line), irq->allowed_mask);
|
||||
fclose(file);
|
||||
free(line);
|
||||
} else {
|
||||
irq->class = find_class(irq, entry->d_name);
|
||||
}
|
||||
|
@ -76,6 +92,15 @@ static void investigate(struct interrupt *irq, int number)
|
|||
closedir(dir);
|
||||
irq->balance_level = map_class_to_level[irq->class];
|
||||
|
||||
for (nr = 0; nr < NR_CPUS; nr++)
|
||||
if (cpu_isset(nr, irq->allowed_mask))
|
||||
count++;
|
||||
|
||||
/* if there is no choice in the allowed mask, don't bother to balance */
|
||||
if (count<2)
|
||||
irq->balance_level = BALANCE_NONE;
|
||||
|
||||
|
||||
/* next, check the IRQBALANCE_BANNED_INTERRUPTS env variable for blacklisted irqs */
|
||||
c = getenv("IRQBALANCE_BANNED_INTERRUPTS");
|
||||
if (!c)
|
||||
|
@ -120,6 +145,7 @@ void set_interrupt_count(int number, uint64_t count, cpumask_t *mask)
|
|||
memset(irq, 0, sizeof(struct interrupt));
|
||||
irq->number = number;
|
||||
irq->count = count;
|
||||
irq->allowed_mask = CPU_MASK_ALL;
|
||||
investigate(irq, number);
|
||||
if (irq->balance_level == BALANCE_NONE)
|
||||
irq->mask = *mask;
|
||||
|
|
14
placement.c
14
placement.c
|
@ -56,6 +56,10 @@ static uint64_t package_cost_func(struct interrupt *irq, struct package *package
|
|||
if (package->class_count[irq->class]>=maxcount && !power_mode)
|
||||
bonus += 300000;
|
||||
|
||||
/* if the package has no cpus in the allowed mask.. just block */
|
||||
if (!cpus_intersects(irq->allowed_mask, package->mask))
|
||||
bonus += 600000;
|
||||
|
||||
return irq->workload + bonus;
|
||||
}
|
||||
|
||||
|
@ -78,6 +82,10 @@ static uint64_t cache_domain_cost_func(struct interrupt *irq, struct cache_domai
|
|||
/* pay 6000 for each previous interrupt of the same class */
|
||||
bonus += CLASS_VIOLATION_PENTALTY * cache_domain->class_count[irq->class];
|
||||
|
||||
/* if the cache domain has no cpus in the allowed mask.. just block */
|
||||
if (!cpus_intersects(irq->allowed_mask, cache_domain->mask))
|
||||
bonus += 600000;
|
||||
|
||||
return irq->workload + bonus;
|
||||
}
|
||||
|
||||
|
@ -103,11 +111,13 @@ static uint64_t cpu_cost_func(struct interrupt *irq, struct cpu_core *cpu)
|
|||
if (first_cpu(cpu->cache_mask)==cpu->number)
|
||||
bonus++;
|
||||
|
||||
|
||||
|
||||
/* pay 6000 for each previous interrupt of the same class */
|
||||
bonus += CLASS_VIOLATION_PENTALTY * cpu->class_count[irq->class];
|
||||
|
||||
/* if the core has no cpus in the allowed mask.. just block */
|
||||
if (!cpus_intersects(irq->allowed_mask, cpu->mask))
|
||||
bonus += 600000;
|
||||
|
||||
return irq->workload + bonus;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue