OSDN Git Service

ionic: improve irq numa locality
authorShannon Nelson <snelson@pensando.io>
Sat, 7 Mar 2020 01:04:03 +0000 (17:04 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Mar 2020 02:34:04 +0000 (19:34 -0700)
Spreading the interrupts across the CPU cores is good for load
balancing, but not necessarily as good when using a CPU/core
that is not part of the NUMA local CPU.  If it can be localized,
the kernel's cpumask_local_spread() service will pick a core
that is on the node close to the PCI device.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/pensando/ionic/ionic_lif.c

index 1b7e18f..7df49b4 100644 (file)
@@ -424,8 +424,9 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type,
                ionic_intr_mask_assert(idev->intr_ctrl, new->intr.index,
                                       IONIC_INTR_MASK_SET);
 
-               new->intr.cpu = new->intr.index % num_online_cpus();
-               if (cpu_online(new->intr.cpu))
+               new->intr.cpu = cpumask_local_spread(new->intr.index,
+                                                    dev_to_node(dev));
+               if (new->intr.cpu != -1)
                        cpumask_set_cpu(new->intr.cpu,
                                        &new->intr.affinity_mask);
        } else {