Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI: hv: Set default NUMA node to 0 for devices without affinity info

When hv_pci_assign_numa_node() processes a device that does not have
HV_PCI_DEVICE_FLAG_NUMA_AFFINITY set or has an out-of-range
virtual_numa_node, the device NUMA node is left unset. On x86_64,
the uninitialized default happens to be 0, but on ARM64 it is
NUMA_NO_NODE (-1).

Tests show that when no NUMA information is available from the Hyper-V
host, devices perform best when assigned to node 0. With NUMA_NO_NODE
the kernel may spread work across NUMA nodes, which degrades
performance on Hyper-V, particularly for high-throughput devices like
MANA.

Always set the device NUMA node to 0 before the conditional NUMA
affinity check, so that devices get a performant default when the host
provides no NUMA information, and behavior is consistent on both
x86_64 and ARM64.

Fixes: 999dd956d838 ("PCI: hv: Add support for protocol 1.3 and support PCI_BUS_RELATIONS2")
Signed-off-by: Long Li <longli@microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>

authored by

Long Li and committed by
Wei Liu
7b3b1e5a c0e296f2

+8
+8
drivers/pci/controller/pci-hyperv.c
··· 2485 2485 if (!hv_dev) 2486 2486 continue; 2487 2487 2488 + /* 2489 + * If the Hyper-V host doesn't provide a NUMA node for the 2490 + * device, default to node 0. With NUMA_NO_NODE the kernel 2491 + * may spread work across NUMA nodes, which degrades 2492 + * performance on Hyper-V. 2493 + */ 2494 + set_dev_node(&dev->dev, 0); 2495 + 2488 2496 if (hv_dev->desc.flags & HV_PCI_DEVICE_FLAG_NUMA_AFFINITY && 2489 2497 hv_dev->desc.virtual_numa_node < num_possible_nodes()) 2490 2498 /*