提交 c265b569 编写于 作者: Í Íñigo Huguet 提交者: Jakub Kicinski

sfc: default config to 1 channel/core in local NUMA node only

Handling channels from CPUs in different NUMA node can penalize
performance, so better configure only one channel per core in the same
NUMA node than the NIC, and not per each core in the system.

Fallback to all other online cores if there are not online CPUs in local
NUMA node.
Signed-off-by: NÍñigo Huguet <ihuguet@redhat.com>
Acked-by: NMartin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 ef739f1d
...@@ -78,31 +78,48 @@ static const struct efx_channel_type efx_default_channel_type = { ...@@ -78,31 +78,48 @@ static const struct efx_channel_type efx_default_channel_type = {
* INTERRUPTS * INTERRUPTS
*************/ *************/
static unsigned int efx_wanted_parallelism(struct efx_nic *efx) static unsigned int count_online_cores(struct efx_nic *efx, bool local_node)
{ {
cpumask_var_t thread_mask; cpumask_var_t filter_mask;
unsigned int count; unsigned int count;
int cpu; int cpu;
if (unlikely(!zalloc_cpumask_var(&filter_mask, GFP_KERNEL))) {
netif_warn(efx, probe, efx->net_dev,
"RSS disabled due to allocation failure\n");
return 1;
}
cpumask_copy(filter_mask, cpu_online_mask);
if (local_node) {
int numa_node = pcibus_to_node(efx->pci_dev->bus);
cpumask_and(filter_mask, filter_mask, cpumask_of_node(numa_node));
}
count = 0;
for_each_cpu(cpu, filter_mask) {
++count;
cpumask_andnot(filter_mask, filter_mask, topology_sibling_cpumask(cpu));
}
free_cpumask_var(filter_mask);
return count;
}
static unsigned int efx_wanted_parallelism(struct efx_nic *efx)
{
unsigned int count;
if (rss_cpus) { if (rss_cpus) {
count = rss_cpus; count = rss_cpus;
} else { } else {
if (unlikely(!zalloc_cpumask_var(&thread_mask, GFP_KERNEL))) { count = count_online_cores(efx, true);
netif_warn(efx, probe, efx->net_dev,
"RSS disabled due to allocation failure\n");
return 1;
}
count = 0;
for_each_online_cpu(cpu) {
if (!cpumask_test_cpu(cpu, thread_mask)) {
++count;
cpumask_or(thread_mask, thread_mask,
topology_sibling_cpumask(cpu));
}
}
free_cpumask_var(thread_mask); /* If no online CPUs in local node, fallback to any online CPUs */
if (count == 0)
count = count_online_cores(efx, false);
} }
if (count > EFX_MAX_RX_QUEUES) { if (count > EFX_MAX_RX_QUEUES) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册