netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Souradeep Chakrabarti <schakrabarti@linux.microsoft.com>
Cc: Souradeep Chakrabarti <schakrabarti@microsoft.com>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	Dexuan Cui <decui@microsoft.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	Long Li <longli@microsoft.com>,
	"sharmaajay@microsoft.com" <sharmaajay@microsoft.com>,
	"leon@kernel.org" <leon@kernel.org>,
	"cai.huoqing@linux.dev" <cai.huoqing@linux.dev>,
	"ssengar@linux.microsoft.com" <ssengar@linux.microsoft.com>,
	"vkuznets@redhat.com" <vkuznets@redhat.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	Yury Norov <yury.norov@gmail.com>
Subject: Re: [EXTERNAL] Re: [PATCH V2 net-next] net: mana: Assigning IRQ affinity on HT cores
Date: Wed, 29 Nov 2023 16:02:02 -0800	[thread overview]
Message-ID: <20231129160202.6d66459f@kernel.org> (raw)
In-Reply-To: <20231129221739.GA20858@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>

On Wed, 29 Nov 2023 14:17:39 -0800 Souradeep Chakrabarti wrote:
> On Mon, Nov 27, 2023 at 10:06:39AM -0800, Jakub Kicinski wrote:
> > On Mon, 27 Nov 2023 09:36:38 +0000 Souradeep Chakrabarti wrote:  
> > > easier to keep things inside the mana driver code here  
> > 
> > Easier for who? Upstream we care about consistency and maintainability
> > across all drivers.  
> I am refactoring the code and putting some of the changes in topology.h
> and in nodemask.h. I am sharing the proposed change here for those two
> files. Please let me know if they are acceptable.

Thanks, adding Yury <yury.norov@gmail.com> who's the best person 
to comment on the details...

> Added a new helper to iterate on numa nodes with cpu and start from a 
> particular node, instead of first node. This helps when we want to
> iterate from the local numa node.
> 
> diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
> index 8d07116caaf1..6e4528376164 100644
> --- a/include/linux/nodemask.h
> +++ b/include/linux/nodemask.h
> @@ -392,6 +392,15 @@ static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp,
>         for ((node) = 0; (node) < 1 && !nodes_empty(mask); (node)++)
>  #endif /* MAX_NUMNODES */
> 
> +#if MAX_NUMNODES > 1
> +#define for_each_node_next_mask(node_start, node_next, mask)           \
> +       for ((node_next) = (node_start);                                \
> +            (node_next) < MAX_NUMNODES;                                \
> +            (node_next) = next_node((node_next), (mask)))
> +#else
> +#define for_each_node_next_mask(node_start, node_next, mask)   \
> +       for_each_node_mask(node_next, mask)
> +#endif
>  /*
>   * Bitmasks that are kept for all the nodes.
>   */
> @@ -440,6 +449,8 @@ static inline int num_node_state(enum node_states state)
> 
>  #define for_each_node_state(__node, __state) \
>         for_each_node_mask((__node), node_states[__state])
> +#define for_each_node_next_state(__node_start, __node_next, __state) \
> +       for_each_node_next_mask((__node_start), (__node_next), node_states[__state])
> 
>  #define first_online_node      first_node(node_states[N_ONLINE])
>  #define first_memory_node      first_node(node_states[N_MEMORY])
> @@ -489,7 +500,8 @@ static inline int num_node_state(enum node_states state)
> 
>  #define for_each_node_state(node, __state) \
>         for ( (node) = 0; (node) == 0; (node) = 1)
> -
> +#define for_each_node_next_state(node, next_node, _state) \
> +       for_each_node_state(node, __state)
>  #define first_online_node      0
>  #define first_memory_node      0
>  #define next_online_node(nid)  (MAX_NUMNODES)
> @@ -535,6 +547,8 @@ static inline int node_random(const nodemask_t *maskp)
> 
>  #define for_each_node(node)       for_each_node_state(node, N_POSSIBLE)
>  #define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
> +#define for_each_online_node_next(node, next_node)  \
> +                                 for_each_node_next_state(node, next_node, N_ONLINE)
> 
>  /*
>   * For nodemask scratch area.
> diff --git a/include/linux/topology.h b/include/linux/topology.h
> index 52f5850730b3..a06b16e5a955 100644
> --- a/include/linux/topology.h
> +++ b/include/linux/topology.h
> @@ -43,6 +43,9 @@
>         for_each_online_node(node)                      \
>                 if (nr_cpus_node(node))
> 
> +#define for_each_next_node_with_cpus(node, next_node)  \
> +               for_each_online_node_next(node, next_node)      \
> +               if (nr_cpus_node(next_node))
>  int arch_update_cpu_topology(void);
> 
>  /* Conform to ACPI 2.0 SLIT distance definitions */
> 


  reply	other threads:[~2023-11-30  0:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 13:54 [PATCH V2 net-next] net: mana: Assigning IRQ affinity on HT cores Souradeep Chakrabarti
2023-11-21 17:37 ` Haiyang Zhang
2023-11-21 18:51 ` Michael Kelley
2023-11-21 22:51 ` kernel test robot
2023-11-21 23:48 ` Jakub Kicinski
2023-11-27  9:36   ` [EXTERNAL] " Souradeep Chakrabarti
2023-11-27 14:32     ` Zhu Yanjun
2023-11-27 18:06     ` Jakub Kicinski
2023-11-29 22:17       ` Souradeep Chakrabarti
2023-11-30  0:02         ` Jakub Kicinski [this message]
2023-11-27 19:07     ` Florian Fainelli
2023-11-29 22:24       ` Souradeep Chakrabarti
2023-11-30  2:16     ` Yury Norov
2023-11-30 12:05       ` Souradeep Chakrabarti
2023-11-30 16:57         ` Yury Norov
2023-12-04  9:02           ` Souradeep Chakrabarti

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=20231129160202.6d66459f@kernel.org \
    --to=kuba@kernel.org \
    --cc=cai.huoqing@linux.dev \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=edumazet@google.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=leon@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=schakrabarti@linux.microsoft.com \
    --cc=schakrabarti@microsoft.com \
    --cc=sharmaajay@microsoft.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@kernel.org \
    --cc=yury.norov@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).