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 676ED41B8A for ; Tue, 31 Jan 2023 09:21:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CEFD41151; Tue, 31 Jan 2023 09:21:50 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id EB920410F6; Tue, 31 Jan 2023 09:21:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675153307; x=1706689307; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5VcbVVZGz0RhaM4E2YaVG1r4zIJiEjILK62PG38RqZU=; b=UIrV/s11ZriBfoGzEqoFWtLlCXAfrpZL719GR0hl3GQS7kgTKyz2KH2/ 4YuC3AoWmpPrwQARvpFf4i3wejRCEV4NT/+o+J9kUfrDvWxVwksq+4w22 q6kO00BcsTde3Vh/mccoGznA4SrIfqunXOiENwSYIvW571aUoV1y7rNCt tlqbg8tAIy9jCnm241NtgMZKeDArYSgu24ZMs9Dh8S6zFpmHw9ZkTNYS9 x958Jlm14XtErLBZrukF7NMNHUvZtI/fYowGl1yCAF/zOWVsIE4Zv8eb1 3yQIHSfXxtmvSX/AjtYGMQDuaAKDpddxZBqhgWK0iM+r77fG4OmGMF7OA A==; X-IronPort-AV: E=McAfee;i="6500,9779,10606"; a="311403269" X-IronPort-AV: E=Sophos;i="5.97,259,1669104000"; d="scan'208";a="311403269" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2023 00:21:44 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10606"; a="772862302" X-IronPort-AV: E=Sophos;i="5.97,259,1669104000"; d="scan'208";a="772862302" Received: from unknown (HELO root..) ([10.239.252.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2023 00:21:41 -0800 From: Kaisen You To: dev@dpdk.org Cc: yidingx.zhou@intel.com, david.marchand@redhat.com, olivier.matz@6wind.com, ferruh.yigit@amd.com, kaisenx.you@intel.com, zhoumin@loongson.cn, anatoly.burakov@intel.com, stable@dpdk.org Subject: [PATCH v4] net/iavf:enhance NUMA affinity heuristic Date: Tue, 31 Jan 2023 15:05:01 +0000 Message-Id: <20230131150501.1180476-1-kaisenx.you@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221104858.296530-1-david.marchand@redhat.com> References: <20221221104858.296530-1-david.marchand@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Trying to allocate memory on the first detected numa node 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). Fixes: 705356f0811f ("eal: simplify control thread creation") Fixes: bb0bd346d5c1 ("eal: suggest using --lcores option") Cc: stable@dpdk.org Signed-off-by: David Marchand Signed-off-by: Kaisen You --- 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 | 1 + lib/eal/common/malloc_heap.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/eal/common/eal_common_thread.c b/lib/eal/common/eal_common_thread.c index 38d83a6885..21bff971f8 100644 --- a/lib/eal/common/eal_common_thread.c +++ b/lib/eal/common/eal_common_thread.c @@ -251,6 +251,7 @@ static void *ctrl_thread_init(void *arg) void *routine_arg = params->arg; __rte_thread_init(rte_lcore_id(), cpuset); + 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 d7c410b786..3ee19aee15 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -717,6 +717,10 @@ malloc_get_numa_socket(void) return socket_id; } + socket_id = rte_lcore_to_socket_id(rte_get_main_lcore()); + if (socket_id != (unsigned int)SOCKET_ID_ANY) + return socket_id; + return rte_socket_id_by_idx(0); } -- 2.34.1