DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Kaisen You <kaisenx.you@intel.com>
Cc: dev@dpdk.org, yidingx.zhou@intel.com, david.marchand@redhat.com,
	olivier.matz@6wind.com, ferruh.yigit@amd.com,
	anatoly.burakov@intel.com, Kaisen You <kaisenx.you@intel.com>,
	stable@dpdk.org
Subject: Re: [PATCH v6] enhance NUMA affinity heuristic
Date: Thu, 27 Apr 2023 08:57:55 +0200	[thread overview]
Message-ID: <10927439.BaYr0rKQ5T@thomas> (raw)
In-Reply-To: <20230425051649.1109428-1-kaisenx.you@intel.com>

25/04/2023 07:16, Kaisen You:
> Trying to allocate memory on the first detected numa node,it has less
> chance to find some memory actually available rather than on the main
> lcore numa node (especially when the DPDK application is started only
> on one numa node).

You didn't change the explanations here as discussed previously.

> 
> Fixes: 8b0a1b8cb481 ("eal: stop using pthread for lcores and control threads")
> Fixes: 770d41bf3309 ("malloc: fix allocation with unknown socket ID")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Kaisen You <kaisenx.you@intel.com>
> 
> ---
> Changes since v5:
> - Add comments to the code,
> 
> Changes since v4:
> - mod the patch title,
> 
> Changes since v3:
> - add the assignment of socket_id in thread initialization,
> 
> Changes since v2:
> - add uncommitted local change and fix compilation,
> 
> Changes since v1:
> - accomodate for configurations with main lcore running on multiples
>   physical cores belonging to different numa,
> ---
>  lib/eal/common/eal_common_thread.c | 4 ++++
>  lib/eal/common/malloc_heap.c       | 6 ++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/lib/eal/common/eal_common_thread.c b/lib/eal/common/eal_common_thread.c
> index 079a385630..d65bfe251b 100644
> --- a/lib/eal/common/eal_common_thread.c
> +++ b/lib/eal/common/eal_common_thread.c
> @@ -252,6 +252,10 @@ static int ctrl_thread_init(void *arg)
>  	struct rte_thread_ctrl_params *params = arg;
>  
>  	__rte_thread_init(rte_lcore_id(), cpuset);
> +	/* set the value of the per-core variable _socket_id.
> +	 * Convenient for threads to find memory.
> +	 */

That's an useless comment.
We want to know WHY you are setting to SOCKET_ID_ANY.

> +	RTE_PER_LCORE(_socket_id) = SOCKET_ID_ANY;
>  	params->ret = rte_thread_set_affinity_by_id(rte_thread_self(), cpuset);
>  	if (params->ret != 0) {
>  		__atomic_store_n(&params->ctrl_thread_status,
> diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c
> index d25bdc98f9..a624f08cf7 100644
> --- a/lib/eal/common/malloc_heap.c
> +++ b/lib/eal/common/malloc_heap.c
> @@ -716,6 +716,12 @@ malloc_get_numa_socket(void)
>  		if (conf->socket_mem[socket_id] != 0)
>  			return socket_id;
>  	}
> +	/* Trying to allocate memory on the main lcore numa node.
> +	 * especially when the DPDK application is started only on one numa node.
> +	 */
> +	socket_id = rte_lcore_to_socket_id(rte_get_main_lcore());
> +	if (socket_id != (unsigned int)SOCKET_ID_ANY)
> +		return socket_id;

You should explain why we could reach this point, i.e. SOCKET_ID_ANY.

>  
>  	return rte_socket_id_by_idx(0);
>  }




  reply	other threads:[~2023-04-27  6:58 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 10:48 [PATCH] malloc: " David Marchand
2022-12-21 11:16 ` Bruce Richardson
2022-12-21 13:50   ` Ferruh Yigit
2022-12-21 14:57 ` David Marchand
2022-12-27  9:00   ` zhoumin
2023-01-03 10:56     ` David Marchand
2023-01-03 10:58 ` [PATCH v2] " David Marchand
2023-01-03 13:32 ` [PATCH v3] " David Marchand
2023-01-31  3:23   ` You, KaisenX
2023-01-31 15:05 ` [PATCH v4] net/iavf:enhance " Kaisen You
2023-01-31 16:05   ` Thomas Monjalon
2023-02-01  5:32     ` You, KaisenX
2023-02-01 12:20 ` [PATCH v5] enhance " Kaisen You
2023-02-01 10:52   ` Jiale, SongX
2023-02-15 14:22   ` Burakov, Anatoly
2023-02-15 14:47     ` Burakov, Anatoly
2023-02-16  2:50     ` You, KaisenX
2023-03-03 14:07       ` Thomas Monjalon
2023-03-09  1:58         ` You, KaisenX
2023-04-13  0:56           ` You, KaisenX
2023-04-19 12:16             ` Thomas Monjalon
2023-04-21  2:34               ` You, KaisenX
2023-04-21  8:12                 ` Thomas Monjalon
2023-04-23  6:52                   ` You, KaisenX
2023-04-23  8:57                     ` You, KaisenX
2023-04-23 13:19                       ` Thomas Monjalon
2023-04-25  5:16   ` [PATCH v6] " Kaisen You
2023-04-27  6:57     ` Thomas Monjalon [this message]
2023-05-16  5:19       ` You, KaisenX
2023-05-23  2:50     ` [PATCH v7] " Kaisen You
2023-05-23 10:44       ` Burakov, Anatoly
2023-05-26  6:44         ` You, KaisenX
2023-05-23 12:45       ` Burakov, Anatoly
2023-05-26  6:50       ` [PATCH v8] " Kaisen You
2023-05-26  8:45       ` Kaisen You
2023-05-26 14:44         ` Burakov, Anatoly
2023-05-26 17:50           ` Stephen Hemminger
2023-05-29 10:37             ` Burakov, Anatoly
2023-06-01 14:42         ` David Marchand
2023-06-06 14:04           ` Thomas Monjalon
2023-06-12  9:36           ` Burakov, Anatoly

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=10927439.BaYr0rKQ5T@thomas \
    --to=thomas@monjalon.net \
    --cc=anatoly.burakov@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=kaisenx.you@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    --cc=yidingx.zhou@intel.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).