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 C83D4A034C; Wed, 21 Dec 2022 11:49:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB9A240A7F; Wed, 21 Dec 2022 11:49:10 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id F187740A7A for ; Wed, 21 Dec 2022 11:49:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671619748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BwojuoyxSYZ9PC+UsDJuTd61pHwjYyZeHk6kkOPnaU4=; b=QzF6X0JYn0ozcFC9YRnJmkRtUW8iZKfT1sGvRwueP/5c3DvxFqTDTcDs5wJF5EurL1V1wL Qg8vGZRu8q8PtxR3DOewLOLcbW/Krd6NVAuXFO27uGWnNb4fXlHPAQajJ32+Z+40dVtpT0 mVlt11oe/rV8WmrYY+aDS3k9pSeH6xA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-602-Q4jP4C7rPFmPL5VufdTLjg-1; Wed, 21 Dec 2022 05:49:06 -0500 X-MC-Unique: Q4jP4C7rPFmPL5VufdTLjg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 867DA3811F43; Wed, 21 Dec 2022 10:49:06 +0000 (UTC) Received: from dmarchan.redhat.com (ovpn-193-100.brq.redhat.com [10.40.193.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E833B492B00; Wed, 21 Dec 2022 10:49:04 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: olivier.matz@6wind.com, ferruh.yigit@amd.com, kaisenx.you@intel.com, Anatoly Burakov Subject: [PATCH] malloc: enhance NUMA affinity heuristic Date: Wed, 21 Dec 2022 11:48:57 +0100 Message-Id: <20221221104858.296530-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 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). Signed-off-by: David Marchand --- lib/eal/common/malloc_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index d7c410b786..08f965a525 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -717,7 +717,7 @@ malloc_get_numa_socket(void) return socket_id; } - return rte_socket_id_by_idx(0); + return rte_lcore_to_socket_id(rte_get_main_lcore()); } void * -- 2.38.1