sparse irq_desc[] array: core kernel and x86 changes
Impact: new feature Problem on distro kernels: irq_desc[NR_IRQS] takes megabytes of RAM with NR_CPUS set to large values. The goal is to be able to scale up to much larger NR_IRQS value without impacting the (important) common case. To solve this, we generalize irq_desc[NR_IRQS] to an (optional) array of irq_desc pointers. When CONFIG_SPARSE_IRQ=y is used, we use kzalloc_node to get irq_desc, this also makes the IRQ descriptors NUMA-local (to the site that calls request_irq()). This gets rid of the irq_cfg[] static array on x86 as well: irq_cfg now uses desc->chip_data for x86 to store irq_cfg. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@ -27,6 +27,7 @@ static int show_stat(struct seq_file *p, void *v)
|
||||
u64 sum = 0;
|
||||
struct timespec boottime;
|
||||
unsigned int per_irq_sum;
|
||||
struct irq_desc *desc;
|
||||
|
||||
user = nice = system = idle = iowait =
|
||||
irq = softirq = steal = cputime64_zero;
|
||||
@ -44,10 +45,11 @@ static int show_stat(struct seq_file *p, void *v)
|
||||
softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
|
||||
steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
|
||||
guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
|
||||
|
||||
for_each_irq_nr(j)
|
||||
for_each_irq_desc(j, desc) {
|
||||
if (!desc)
|
||||
continue;
|
||||
sum += kstat_irqs_cpu(j, i);
|
||||
|
||||
}
|
||||
sum += arch_irq_stat_cpu(i);
|
||||
}
|
||||
sum += arch_irq_stat();
|
||||
@ -90,11 +92,14 @@ static int show_stat(struct seq_file *p, void *v)
|
||||
seq_printf(p, "intr %llu", (unsigned long long)sum);
|
||||
|
||||
/* sum again ? it could be updated? */
|
||||
for_each_irq_nr(j) {
|
||||
for (j = 0; j < NR_IRQS; j++) {
|
||||
desc = irq_to_desc(j);
|
||||
per_irq_sum = 0;
|
||||
|
||||
for_each_possible_cpu(i)
|
||||
per_irq_sum += kstat_irqs_cpu(j, i);
|
||||
if (desc) {
|
||||
for_each_possible_cpu(i)
|
||||
per_irq_sum += kstat_irqs_cpu(j, i);
|
||||
}
|
||||
|
||||
seq_printf(p, " %u", per_irq_sum);
|
||||
}
|
||||
|
Reference in New Issue
Block a user