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 1E3C245CB1; Thu, 7 Nov 2024 09:04:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 488F042ED6; Thu, 7 Nov 2024 09:04:57 +0100 (CET) Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2]) by mails.dpdk.org (Postfix) with ESMTP id 9853942ED3 for ; Thu, 7 Nov 2024 09:04:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=DcxmQH4MBrcL72TE51 zbVLjM9JBcJNwuko+b5KoJoDQ=; b=hjw5dxUCgV/8r6KSOYQ0XIQiFkMDYPABC0 6KtPTbOD0UXiJEPBpwiJ0z7BtLzadypp4VafXrdrQxOBH+qZ3kQQrmQbEJcVid/q YofcwIXOtODH+meDmTuCQIABgRY8kA4ujJ+/dLVztulBAiSHqfqVq42HpRWc+9NU j2ADUkApo= Received: from localhost.localdomain.localdomain (unknown [124.127.58.139]) by gzga-smtp-mtada-g0-2 (Coremail) with SMTP id _____wAnr0addCxnrjnQFw--.6071S2; Thu, 07 Nov 2024 16:04:51 +0800 (CST) From: Huichao cai To: jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com, yanzhirun_163@163.com Cc: dev@dpdk.org Subject: [PATCH] graph: optimize graph search when scheduling nodes Date: Thu, 7 Nov 2024 16:04:42 +0800 Message-Id: <1730966682-2632-1-git-send-email-chcchc88@163.com> X-Mailer: git-send-email 1.8.3.1 X-CM-TRANSID: _____wAnr0addCxnrjnQFw--.6071S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Ww47CrWkuF18AFyUWry3Arb_yoW8Cw4kp3 WfK3WfJFWUKF1fKr1vgF4UXFW8K3ZYy39FgryrWFnxJrZxJr13A348tFyUtF43XrW3Ca1x C3yxJr1UKr1Uua7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jYnmiUUUUU= X-Originating-IP: [124.127.58.139] X-CM-SenderInfo: pfkfuxrfyyqiywtou0bp/xtbBDh6KF2ckfwHg-gAGso 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 In the function __rte_graph_ccore_ispatch_stched_node_dequeue, use a slower loop to search for the graph, modify the search logic to record the result of the first search, and use this record for subsequent searches to improve search speed. Signed-off-by: Huichao cai --- lib/graph/rte_graph_model_mcore_dispatch.c | 11 +++++++---- lib/graph/rte_graph_worker_common.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/graph/rte_graph_model_mcore_dispatch.c b/lib/graph/rte_graph_model_mcore_dispatch.c index a590fc9..a81d338 100644 --- a/lib/graph/rte_graph_model_mcore_dispatch.c +++ b/lib/graph/rte_graph_model_mcore_dispatch.c @@ -118,11 +118,14 @@ struct rte_graph_rq_head *rq) { const unsigned int lcore_id = node->dispatch.lcore_id; - struct rte_graph *graph; + struct rte_graph *graph = node->dispatch.graph; - SLIST_FOREACH(graph, rq, next) - if (graph->dispatch.lcore_id == lcore_id) - break; + if (unlikely((!graph) || (graph->dispatch.lcore_id != lcore_id))) { + SLIST_FOREACH(graph, rq, next) + if (graph->dispatch.lcore_id == lcore_id) + break; + node->dispatch.graph = graph; + } return graph != NULL ? __graph_sched_node_enqueue(node, graph) : false; } diff --git a/lib/graph/rte_graph_worker_common.h b/lib/graph/rte_graph_worker_common.h index a518af2..4c2432b 100644 --- a/lib/graph/rte_graph_worker_common.h +++ b/lib/graph/rte_graph_worker_common.h @@ -110,6 +110,7 @@ struct __rte_cache_aligned rte_node { unsigned int lcore_id; /**< Node running lcore. */ uint64_t total_sched_objs; /**< Number of objects scheduled. */ uint64_t total_sched_fail; /**< Number of scheduled failure. */ + struct rte_graph *graph; /**< Graph corresponding to lcore_id. */ } dispatch; }; rte_graph_off_t xstat_off; /**< Offset to xstat counters. */ -- 1.8.3.1