Skip to content

Commit 0b8f1ef

Browse files
Yinghai LuIngo Molnar
authored andcommitted
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>
1 parent 218d11a commit 0b8f1ef

23 files changed

Lines changed: 649 additions & 163 deletions

File tree

‎arch/x86/Kconfig‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,16 @@ config X86_HAS_BOOT_CPU_ID
238238
def_bool y
239239
depends on X86_VOYAGER
240240

241+
config SPARSE_IRQ
242+
bool "Support sparse irq numbering"
243+
depends on PCI_MSI || HT_IRQ
244+
default y
245+
help
246+
This enables support for sparse irq, esp for msi/msi-x. You may need
247+
if you have lots of cards supports msi-x installed.
248+
249+
If you don't know what to do here, say Y.
250+
241251
config X86_FIND_SMP_CONFIG
242252
def_bool y
243253
depends on X86_MPPARSE || X86_VOYAGER

‎arch/x86/include/asm/irq_vectors.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,20 @@
102102
#define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15)
103103

104104
#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_X86_VOYAGER)
105+
106+
#ifndef CONFIG_SPARSE_IRQ
105107
# if NR_CPUS < MAX_IO_APICS
106108
# define NR_IRQS (NR_VECTORS + (32 * NR_CPUS))
107109
# else
108110
# define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS))
109111
# endif
112+
#else
113+
# if (8 * NR_CPUS) > (32 * MAX_IO_APICS)
114+
# define NR_IRQS (NR_VECTORS + (8 * NR_CPUS))
115+
# else
116+
# define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS))
117+
# endif
118+
#endif
110119

111120
#elif defined(CONFIG_X86_VOYAGER)
112121

0 commit comments

Comments
 (0)