All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Ahmed Zaki <ahmed.zaki@intel.com>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
	andrew+netdev@lunn.ch, edumazet@google.com, horms@kernel.org,
	pabeni@redhat.com, davem@davemloft.net,
	michael.chan@broadcom.com, tariqt@nvidia.com,
	anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
	jdamato@fastly.com, shayd@nvidia.com, akpm@linux-foundation.org,
	shayagr@amazon.com, kalesh-anakkur.purayil@broadcom.com
Subject: Re: [Intel-wired-lan] [PATCH net-next v6 2/5] net: napi: add CPU affinity to napi_config
Date: Mon, 20 Jan 2025 17:03:12 -0800	[thread overview]
Message-ID: <20250120170312.1af6b7e7@kernel.org> (raw)
In-Reply-To: <20250118003335.155379-3-ahmed.zaki@intel.com>

On Fri, 17 Jan 2025 17:33:32 -0700 Ahmed Zaki wrote:
> A common task for most drivers is to remember the user-set CPU affinity
> to its IRQs. On each netdev reset, the driver should re-assign the
> user's settings to the IRQs.

> @@ -393,8 +394,8 @@ struct napi_struct {
>  	struct list_head	dev_list;
>  	struct hlist_node	napi_hash_node;
>  	int			irq;
> -#ifdef CONFIG_RFS_ACCEL
>  	struct irq_affinity_notify notify;
> +#ifdef CONFIG_RFS_ACCEL

Let's remove the #ifdef completely, one int won't make much difference,
it's ~1% of the whole struct..

> @@ -11585,7 +11606,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
>  {
>  	struct net_device *dev;
>  	size_t napi_config_sz;
> -	unsigned int maxqs;
> +	unsigned int maxqs, i, numa;

nit: reverse xmas tree

>  	BUG_ON(strlen(name) >= sizeof(dev->name));
>  
> @@ -11681,6 +11702,10 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
>  	dev->napi_config = kvzalloc(napi_config_sz, GFP_KERNEL_ACCOUNT);
>  	if (!dev->napi_config)
>  		goto free_all;

nit: empty line here

> +	numa = dev_to_node(&dev->dev);
> +	for (i = 0; i < maxqs; i++)
> +		cpumask_set_cpu(cpumask_local_spread(i, numa),
> +				&dev->napi_config[i].affinity_mask);
>  
>  	strscpy(dev->name, name);
>  	dev->name_assign_type = name_assign_type;


WARNING: multiple messages have this Message-ID (diff)
From: Jakub Kicinski <kuba@kernel.org>
To: Ahmed Zaki <ahmed.zaki@intel.com>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
	andrew+netdev@lunn.ch, edumazet@google.com, horms@kernel.org,
	pabeni@redhat.com, davem@davemloft.net,
	michael.chan@broadcom.com, tariqt@nvidia.com,
	anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
	jdamato@fastly.com, shayd@nvidia.com, akpm@linux-foundation.org,
	shayagr@amazon.com, kalesh-anakkur.purayil@broadcom.com
Subject: Re: [PATCH net-next v6 2/5] net: napi: add CPU affinity to napi_config
Date: Mon, 20 Jan 2025 17:03:12 -0800	[thread overview]
Message-ID: <20250120170312.1af6b7e7@kernel.org> (raw)
In-Reply-To: <20250118003335.155379-3-ahmed.zaki@intel.com>

On Fri, 17 Jan 2025 17:33:32 -0700 Ahmed Zaki wrote:
> A common task for most drivers is to remember the user-set CPU affinity
> to its IRQs. On each netdev reset, the driver should re-assign the
> user's settings to the IRQs.

> @@ -393,8 +394,8 @@ struct napi_struct {
>  	struct list_head	dev_list;
>  	struct hlist_node	napi_hash_node;
>  	int			irq;
> -#ifdef CONFIG_RFS_ACCEL
>  	struct irq_affinity_notify notify;
> +#ifdef CONFIG_RFS_ACCEL

Let's remove the #ifdef completely, one int won't make much difference,
it's ~1% of the whole struct..

> @@ -11585,7 +11606,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
>  {
>  	struct net_device *dev;
>  	size_t napi_config_sz;
> -	unsigned int maxqs;
> +	unsigned int maxqs, i, numa;

nit: reverse xmas tree

>  	BUG_ON(strlen(name) >= sizeof(dev->name));
>  
> @@ -11681,6 +11702,10 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
>  	dev->napi_config = kvzalloc(napi_config_sz, GFP_KERNEL_ACCOUNT);
>  	if (!dev->napi_config)
>  		goto free_all;

nit: empty line here

> +	numa = dev_to_node(&dev->dev);
> +	for (i = 0; i < maxqs; i++)
> +		cpumask_set_cpu(cpumask_local_spread(i, numa),
> +				&dev->napi_config[i].affinity_mask);
>  
>  	strscpy(dev->name, name);
>  	dev->name_assign_type = name_assign_type;


  reply	other threads:[~2025-01-21  1:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-18  0:33 [Intel-wired-lan] [PATCH net-next v6 0/5] net: napi: add CPU affinity to napi->config Ahmed Zaki
2025-01-18  0:33 ` Ahmed Zaki
2025-01-18  0:33 ` [Intel-wired-lan] [PATCH net-next v6 1/5] net: move ARFS rmap management to core Ahmed Zaki
2025-01-18  0:33   ` Ahmed Zaki
2025-01-21  0:59   ` [Intel-wired-lan] " Jakub Kicinski
2025-01-21  0:59     ` Jakub Kicinski
2025-01-21 14:52     ` [Intel-wired-lan] " Ahmed Zaki
2025-01-21 14:52       ` Ahmed Zaki
2025-01-23 19:28   ` [Intel-wired-lan] " Joe Damato
2025-01-23 19:28     ` Joe Damato
2025-01-23 20:13     ` [Intel-wired-lan] " Ahmed Zaki
2025-01-23 20:13       ` Ahmed Zaki
2025-01-23 20:20       ` [Intel-wired-lan] " Joe Damato
2025-01-23 20:20         ` Joe Damato
2025-01-18  0:33 ` [Intel-wired-lan] [PATCH net-next v6 2/5] net: napi: add CPU affinity to napi_config Ahmed Zaki
2025-01-18  0:33   ` Ahmed Zaki
2025-01-21  1:03   ` Jakub Kicinski [this message]
2025-01-21  1:03     ` Jakub Kicinski
2025-01-23 20:18   ` [Intel-wired-lan] " Joe Damato
2025-01-23 20:18     ` Joe Damato
2025-02-03 21:32     ` [Intel-wired-lan] " Ahmed Zaki
2025-02-03 21:32       ` Ahmed Zaki
2025-01-18  0:33 ` [Intel-wired-lan] [PATCH net-next v6 3/5] bnxt: use napi's irq affinity Ahmed Zaki
2025-01-18  0:33   ` Ahmed Zaki
2025-01-18  0:33 ` [Intel-wired-lan] [PATCH net-next v6 4/5] ice: " Ahmed Zaki
2025-01-18  0:33   ` Ahmed Zaki
2025-01-18  0:33 ` [Intel-wired-lan] [PATCH net-next v6 5/5] idpf: " Ahmed Zaki
2025-01-18  0:33   ` Ahmed Zaki
2025-01-21  1:03 ` [Intel-wired-lan] [PATCH net-next v6 0/5] net: napi: add CPU affinity to napi->config Jakub Kicinski
2025-01-21  1:03   ` Jakub Kicinski
2025-01-21 14:54   ` [Intel-wired-lan] " Ahmed Zaki
2025-01-21 14:54     ` Ahmed Zaki
2025-01-23 20:27 ` [Intel-wired-lan] " Joe Damato
2025-01-23 20:27   ` Joe Damato

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=20250120170312.1af6b7e7@kernel.org \
    --to=kuba@kernel.org \
    --cc=ahmed.zaki@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jdamato@fastly.com \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=shayagr@amazon.com \
    --cc=shayd@nvidia.com \
    --cc=tariqt@nvidia.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.