Messages in this thread Patch in this message | | | Date | Sun, 03 Jan 2010 22:58:21 -0800 | From | Yinghai Lu <> | Subject | [PATCH 2/2] x86: get more exact nr_irqs |
| |
first check with NR_VECTORS - FIRST_EXTERNAL_VECTOR - 0x20 aka minus exceptions and system vectors.
NR_CPUS = 512, and nr_cpu_ids = 128 will have NR_IRQS = 256 + 512 * 64 = 33024
assume we have 20 intel ixgbe 6 port cards (with sriov and ixgbevf) 20 * 6 * 64 * 3 = 23040
first will get: 128 * (256 - 64) = 24576 then with nr_irqs_gsi will get (120 + 8 * 128 + 120 * 256) = 31864
so 24576 will be used for nr_irqs.
24576 * 8 = 196608 bytes will be used for irq_desc_ptrs[]
before this patch: have nr_irqs = 120 + 8 * 128 + 120 * 64 = 8824 and irq_desc_ptrs[] is 70592
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
--- arch/x86/kernel/apic/io_apic.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Index: linux-2.6/arch/x86/kernel/apic/io_apic.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c +++ linux-2.6/arch/x86/kernel/apic/io_apic.c @@ -3833,15 +3833,20 @@ int __init arch_probe_nr_irqs(void) { int nr; - if (nr_irqs > (NR_VECTORS * nr_cpu_ids)) - nr_irqs = NR_VECTORS * nr_cpu_ids; + /* 0x20 for ipi etc system vectors */ + nr = NR_VECTORS - FIRST_EXTERNAL_VECTOR - 0x20; + + nr *= nr_cpu_ids; + + if (nr < nr_irqs) + nr_irqs = nr; 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 * 64; + nr += nr_irqs_gsi * 256; #endif if (nr < nr_irqs) nr_irqs = nr;
| |