All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Habets <habetsm.xilinx@gmail.com>
To: "Íñigo Huguet" <ihuguet@redhat.com>
Cc: ecree.xilinx@gmail.com, davem@davemloft.net, kuba@kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next resend 1/2] sfc: default config to 1 channel/core in local NUMA node only
Date: Sat, 19 Feb 2022 13:50:16 +0000	[thread overview]
Message-ID: <20220219135016.qa6fv3pfnrrokw2q@gmail.com> (raw)
In-Reply-To: <20220216094139.15989-2-ihuguet@redhat.com>

On Wed, Feb 16, 2022 at 10:41:38AM +0100, Íñigo Huguet wrote:
> 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: Íñigo Huguet <ihuguet@redhat.com>

Acked-by: Martin Habets <habetsm.xilinx@gmail.com>

> ---
>  drivers/net/ethernet/sfc/efx_channels.c | 50 ++++++++++++++++---------
>  1 file changed, 33 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
> index ead550ae2709..ec6c2f231e73 100644
> --- a/drivers/net/ethernet/sfc/efx_channels.c
> +++ b/drivers/net/ethernet/sfc/efx_channels.c
> @@ -78,31 +78,48 @@ static const struct efx_channel_type efx_default_channel_type = {
>   * 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;
>  	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) {
>  		count = rss_cpus;
>  	} else {
> -		if (unlikely(!zalloc_cpumask_var(&thread_mask, GFP_KERNEL))) {
> -			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));
> -			}
> -		}
> +		count = count_online_cores(efx, true);
>  
> -		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) {
> -- 
> 2.31.1

-- 
Martin Habets <habetsm.xilinx@gmail.com>

  reply	other threads:[~2022-02-19 13:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 15:19 [PATCH net-next 0/2] sfc: optimize RXQs count and affinities Íñigo Huguet
2022-01-28 15:19 ` [PATCH net-next 1/2] sfc: default config to 1 channel/core in local NUMA node only Íñigo Huguet
2022-01-28 22:27   ` Jakub Kicinski
2022-02-07 15:03     ` Íñigo Huguet
2022-02-07 16:53       ` Jakub Kicinski
2022-02-10  9:35         ` Íñigo Huguet
2022-02-10 16:22           ` Jakub Kicinski
2022-02-11 11:05             ` Íñigo Huguet
2022-02-11 19:01               ` Jakub Kicinski
2022-02-14  7:22                 ` Íñigo Huguet
2022-02-19 13:53                 ` Martin Habets
2022-01-28 15:19 ` [PATCH net-next 2/2] sfc: set affinity hints " Íñigo Huguet
2022-02-16  9:41 ` [PATCH net-next resend 0/2] sfc: optimize RXQs count and affinities Íñigo Huguet
2022-02-16  9:41   ` [PATCH net-next resend 1/2] sfc: default config to 1 channel/core in local NUMA node only Íñigo Huguet
2022-02-19 13:50     ` Martin Habets [this message]
2022-02-16  9:41   ` [PATCH net-next resend 2/2] sfc: set affinity hints " Íñigo Huguet
2022-02-19 13:51     ` Martin Habets
2022-02-19  5:19   ` [PATCH net-next resend 0/2] sfc: optimize RXQs count and affinities Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220219135016.qa6fv3pfnrrokw2q@gmail.com \
    --to=habetsm.xilinx@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=ihuguet@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.