Commit f1ee5548 authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar

x86/irq: optimize nr_irqs

Impact: make nr_irqs depend more on cards used in a system

depend on nr_irq_gsi more, and have a ratio for MSI.

v2: make nr_irqs less than NR_VECTORS * nr_cpu_ids
    aka if only one cpu, we only can support nr_irqs = NR_VECTORS
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 8f9ca475
...@@ -3479,9 +3479,9 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) ...@@ -3479,9 +3479,9 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
sub_handle = 0; sub_handle = 0;
list_for_each_entry(msidesc, &dev->msi_list, list) { list_for_each_entry(msidesc, &dev->msi_list, list) {
irq = create_irq_nr(irq_want); irq = create_irq_nr(irq_want);
irq_want++;
if (irq == 0) if (irq == 0)
return -1; return -1;
irq_want = irq + 1;
#ifdef CONFIG_INTR_REMAP #ifdef CONFIG_INTR_REMAP
if (!intr_remapping_enabled) if (!intr_remapping_enabled)
goto no_ir; goto no_ir;
...@@ -3825,11 +3825,17 @@ int __init arch_probe_nr_irqs(void) ...@@ -3825,11 +3825,17 @@ int __init arch_probe_nr_irqs(void)
{ {
int nr; int nr;
nr = ((8 * nr_cpu_ids) > (32 * nr_ioapics) ? if (nr_irqs > (NR_VECTORS * nr_cpu_ids))
(NR_VECTORS + (8 * nr_cpu_ids)) : nr_irqs = NR_VECTORS * nr_cpu_ids;
(NR_VECTORS + (32 * nr_ioapics)));
if (nr < nr_irqs && nr > nr_irqs_gsi) nr = nr_irqs_gsi + 8 * nr_cpu_ids;
#if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ)
/*
* for MSI and HT dyn irq
*/
nr += nr_irqs_gsi * 16;
#endif
if (nr < nr_irqs)
nr_irqs = nr; nr_irqs = nr;
return 0; return 0;
......
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