From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D06242A08; Thu, 27 Apr 2023 08:58:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0B8342D3C; Thu, 27 Apr 2023 08:58:03 +0200 (CEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by mails.dpdk.org (Postfix) with ESMTP id B521C40A7D; Thu, 27 Apr 2023 08:58:01 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 288EE5C01E3; Thu, 27 Apr 2023 02:57:59 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 27 Apr 2023 02:57:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1682578679; x=1682665079; bh=Vs4kxuwY5IZA2l/hfO6zoDvKvP/LMSlCir+ PcNQ83LU=; b=gs5D9ed93J5RVhnSLDXmqCIXU2QoD/eJyuLJa7SkYe5rg7YypNC t5Oyvk7HglWWMaLosqrdfxBQHO+ZHpKsrShzOTvCLtras6ZAXED7tsppSek/BiQ0 TRAmDZP3mt0LmnUXtfZr4h0GyNi1Esj5GhEATPkh/JNtqrTSVGMCApct7oyUeWAv 2iZWd1YAG15iwvypXqYpYwHe+vermW88HbwKfqAGi8aA7vKKfGiVvIoeSebS0GiZ /d9+7l1BF2CDsev1trdfVlME3LSzqeGFLWzcPIvw60bApsgZjSGMkflU6Ml5SVHM oPXaAzwcNsrFENQCO/79RojeC+orqz28XMA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1682578679; x=1682665079; bh=Vs4kxuwY5IZA2l/hfO6zoDvKvP/LMSlCir+ PcNQ83LU=; b=PNgxpWbAeOVlNTYv9NOMyR6TvQvv8xrAd26QruBXEGWz2jowq3o C/TJ3C+kMxgpVaoT4UYPRtu7bs8ab1pQo/Aj1kQGdC3KvGKiUjjxkmS5QupfVVzJ 3yfynV2EOErwuTEWe1ebxi/GLS6CzijA0uSKyO1QxVv9HmTtFxZ/HnuGdSKDzjoT GiUIGOno0KLomETP0SdP0ptSTK9tomeLOY5cP/PgefGyRRLRP1kdHBJBSDd3pQUO VqqBGDpQ4pJZCtZH189pMnnK6Me/rbl29lk2e/Aj06Gh7Lar2GgKfsaN+VNM5+RK CBNdOZU90xBTY71M/tvG6YGY+KWwtdVNCGw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeduhedguddugecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkjghfggfgtgesth furedttddtvdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgr shesmhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedtjeeiieefhedtff fgvdelteeufeefheeujefgueetfedttdeikefgkeduhedtgfenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghloh hnrdhnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Apr 2023 02:57:57 -0400 (EDT) From: Thomas Monjalon To: Kaisen You 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 , stable@dpdk.org Subject: Re: [PATCH v6] enhance NUMA affinity heuristic Date: Thu, 27 Apr 2023 08:57:55 +0200 Message-ID: <10927439.BaYr0rKQ5T@thomas> In-Reply-To: <20230425051649.1109428-1-kaisenx.you@intel.com> References: <20230201122048.1283392-1-kaisenx.you@intel.com> <20230425051649.1109428-1-kaisenx.you@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 > Signed-off-by: Kaisen You > > --- > 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(¶ms->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); > }