Skip to content

Commit 15e957d

Browse files
Yinghai LuIngo Molnar
authored andcommitted
x86/irq: use move_irq_desc() in create_irq_nr()
move_irq_desc() will try to move irq_desc to the home node if the allocated one is not correct, in create_irq_nr(). ( This can happen on devices that are on different nodes that are using MSI, when drivers are loaded and unloaded randomly. ) v2: fix non-smp build v3: add NUMA_IRQ_DESC to eliminate #ifdefs [ Impact: improve irq descriptor locality on NUMA systems ] Signed-off-by: Yinghai Lu <yinghai@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Suresh Siddha <suresh.b.siddha@intel.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Rusty Russell <rusty@rustcorp.com.au> LKML-Reference: <49F95EAE.2050903@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 56b581e commit 15e957d

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

‎arch/x86/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ config SPARSE_IRQ
274274

275275
If you don't know what to do here, say N.
276276

277+
config NUMA_IRQ_DESC
278+
def_bool y
279+
depends on SPARSE_IRQ && NUMA
280+
277281
config X86_MPPARSE
278282
bool "Enable MPS table" if ACPI
279283
default y

‎arch/x86/kernel/apic/io_apic.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,11 +3197,7 @@ unsigned int create_irq_nr(unsigned int irq_want, int node)
31973197
if (cfg_new->vector != 0)
31983198
continue;
31993199

3200-
#ifdef CONFIG_NUMA_IRQ_DESC
3201-
/* different node ?*/
3202-
if (desc_new->node != node)
3203-
desc = move_irq_desc(desc, node);
3204-
#endif
3200+
desc_new = move_irq_desc(desc_new, node);
32053201

32063202
if (__assign_irq_vector(new, cfg_new, apic->target_cpus()) == 0)
32073203
irq = new;

‎include/linux/irq.h‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,16 @@ extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc
206206

207207
#ifndef CONFIG_SPARSE_IRQ
208208
extern struct irq_desc irq_desc[NR_IRQS];
209-
#else /* CONFIG_SPARSE_IRQ */
209+
#endif
210+
211+
#ifdef CONFIG_NUMA_IRQ_DESC
210212
extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int node);
211-
#endif /* CONFIG_SPARSE_IRQ */
213+
#else
214+
static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
215+
{
216+
return desc;
217+
}
218+
#endif
212219

213220
extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
214221

‎kernel/irq/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ obj-y := handle.o manage.o spurious.o resend.o chip.o devres.o
33
obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o
44
obj-$(CONFIG_PROC_FS) += proc.o
55
obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o
6-
obj-$(CONFIG_SPARSE_IRQ) += numa_migrate.o
6+
obj-$(CONFIG_NUMA_IRQ_DESC) += numa_migrate.o
77
obj-$(CONFIG_PM_SLEEP) += pm.o

0 commit comments

Comments
 (0)