All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Valentin Schneider <vschneid@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>
Cc: Tariq Toukan <tariqt@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Gal Pressman <gal@nvidia.com>,
	Vincent Guittot <vincent.guittot@linaro.org>
Subject: Re: [PATCH 2/2] net/mlx5e: Leverage sched_numa_hop_mask()
Date: Wed, 10 Aug 2022 15:57:33 +0300	[thread overview]
Message-ID: <8448dade-a64a-0b6b-1ed0-dd164917eedf@gmail.com> (raw)
In-Reply-To: <20220810105119.2684079-2-vschneid@redhat.com>



On 8/10/2022 1:51 PM, Valentin Schneider wrote:
> Signed-off-by: Valentin Schneider <vschneid@redhat.com>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/eq.c | 16 ++++++++++++++--
>   1 file changed, 14 insertions(+), 2 deletions(-)
> 

Missing description.

I had a very detailed description with performance numbers and an 
affinity hints example with before/after tables. I don't want to get 
them lost.


> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> index 229728c80233..2eb4ffd96a95 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> @@ -809,9 +809,12 @@ static void comp_irqs_release(struct mlx5_core_dev *dev)
>   static int comp_irqs_request(struct mlx5_core_dev *dev)
>   {
>   	struct mlx5_eq_table *table = dev->priv.eq_table;
> +	const struct cpumask *mask;
>   	int ncomp_eqs = table->num_comp_eqs;
> +	int hops = 0;
>   	u16 *cpus;
>   	int ret;
> +	int cpu;
>   	int i;
>   
>   	ncomp_eqs = table->num_comp_eqs;
> @@ -830,8 +833,17 @@ static int comp_irqs_request(struct mlx5_core_dev *dev)
>   		ret = -ENOMEM;
>   		goto free_irqs;
>   	}
> -	for (i = 0; i < ncomp_eqs; i++)
> -		cpus[i] = cpumask_local_spread(i, dev->priv.numa_node);
> +
> +	rcu_read_lock();
> +	for_each_numa_hop_mask(dev->priv.numa_node, hops, mask) {

We don't really use this 'hops' iterator. We always pass 0 (not a 
valuable input...), and we do not care about its final value. Probably 
it's best to hide it from the user into the macro.

> +		for_each_cpu(cpu, mask) {
> +			cpus[i] = cpu;
> +			if (++i == ncomp_eqs)
> +				goto spread_done;
> +		}
> +	}
> +spread_done:
> +	rcu_read_unlock();
>   	ret = mlx5_irqs_request_vectors(dev, cpus, ncomp_eqs, table->comp_irqs);
>   	kfree(cpus);
>   	if (ret < 0)

This logic is typical. Other drivers would also want to use it.
It must be introduced as a service/API function, if not by the sched 
topology, then at least by the networking subsystem.
Jakub, WDYT?

  reply	other threads:[~2022-08-10 12:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 19:12 [PATCH net-next V4 0/3] Introduce and use NUMA distance metrics Tariq Toukan
2022-07-28 19:12 ` [PATCH net-next V4 1/3] sched/topology: Add NUMA-based CPUs spread API Tariq Toukan
2022-07-30 17:29   ` Tariq Toukan
2022-08-02  6:40     ` Tariq Toukan
2022-08-02  9:38       ` Valentin Schneider
2022-08-02 16:05         ` Jakub Kicinski
2022-08-04 17:28   ` Valentin Schneider
2022-08-08 14:39     ` Tariq Toukan
2022-08-09 10:02       ` Valentin Schneider
2022-08-09 10:18         ` Tariq Toukan
2022-08-09 12:52           ` Valentin Schneider
2022-08-09 14:04             ` Tariq Toukan
2022-08-09 17:36               ` Valentin Schneider
2022-08-10 10:46                 ` Valentin Schneider
2022-08-10 10:51                   ` [PATCH 1/2] sched/topology: Introduce sched_numa_hop_mask() Valentin Schneider
2022-08-10 10:51                     ` [PATCH 2/2] net/mlx5e: Leverage sched_numa_hop_mask() Valentin Schneider
2022-08-10 12:57                       ` Tariq Toukan [this message]
2022-08-10 17:42                         ` Jakub Kicinski
2022-08-11 14:26                         ` Valentin Schneider
2022-08-10 12:42                     ` [PATCH 1/2] sched/topology: Introduce sched_numa_hop_mask() Tariq Toukan
2022-08-10 12:57                       ` Tariq Toukan
2022-08-11 14:26                         ` Valentin Schneider
2022-08-14  8:19                           ` Tariq Toukan
2022-08-14  8:26                             ` Tariq Toukan
2022-08-15 14:20                             ` Valentin Schneider
2022-07-28 19:12 ` [PATCH net-next V4 2/3] net/mlx5e: Improve remote NUMA preferences used for the IRQ affinity hints Tariq Toukan
2022-07-28 19:12 ` [PATCH net-next V4 3/3] enic: Use NUMA distances logic when setting " Tariq Toukan

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=8448dade-a64a-0b6b-1ed0-dd164917eedf@gmail.com \
    --to=ttoukan.linux@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=juri.lelli@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peterz@infradead.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /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.