LKML Archive on
help / color / mirror / Atom feed
* [PATCH] genirq: set initial affinity when hinting
@ 2014-12-19  1:22 Jesse Brandeburg
  2014-12-19 19:53 ` Jesse Brandeburg
  2015-01-23 10:42 ` [tip:irq/core] genirq: Set initial affinity in irq_set_affinity_hint() tip-bot for Jesse Brandeburg
  0 siblings, 2 replies; 8+ messages in thread
From: Jesse Brandeburg @ 2014-12-19  1:22 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel

The default behavior of the kernel is somewhat undesirable as all
requested interrupts end up on CPU0 after registration.  A user can
run irqbalance daemon, or can manually configure smp_affinity via the
proc filesystem, but the default affinity of the interrupts for all
devices is always CPU zero, this can cause performance problems or
very heavy cpu use of only one core if not noticed and fixed by the

This patch enables the setting of the initial affinity directly
when the driver sets a hint.

This enabling means that kernel drivers can include an initial
affinity setting for the interrupt, instead of all interrupts starting
out life on CPU0. Of course if irqbalance is still running then the
interrupts will get moved as before.

This function is currently called by drivers in block, crypto,
infiniband, ethernet and scsi trees, but only a handful, so these will
be the devices affected by this change.

Tested on i40e, and default interrupts were spread across the CPUs
according to the hint.


Signed-off-by: Jesse Brandeburg <>
CC: Thomas Gleixner <>
 kernel/irq/manage.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 8069237..f038e58 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -243,6 +243,8 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
 		return -EINVAL;
 	desc->affinity_hint = m;
 	irq_put_desc_unlock(desc, flags);
+	/* set the initial affinity to prevent every interrupt being on CPU0 */
+	__irq_set_affinity(irq, m, false);
 	return 0;

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-02-09 17:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-19  1:22 [PATCH] genirq: set initial affinity when hinting Jesse Brandeburg
2014-12-19 19:53 ` Jesse Brandeburg
2015-01-23 10:42 ` [tip:irq/core] genirq: Set initial affinity in irq_set_affinity_hint() tip-bot for Jesse Brandeburg
2015-01-28  6:36   ` Yinghai Lu
2015-01-28 16:43     ` Jesse Brandeburg
2015-01-28 19:58     ` Jesse Brandeburg
2015-02-09  8:22       ` Ingo Molnar
2015-02-09 17:48         ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).