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 CB47B45CE2; Mon, 11 Nov 2024 05:03:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 86D0A40685; Mon, 11 Nov 2024 05:03:39 +0100 (CET) Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.2]) by mails.dpdk.org (Postfix) with ESMTP id 1EDE04067A for ; Mon, 11 Nov 2024 05:03:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=g7SlOunFa3eWqasYID PeKeGAE+v2B+N4JeYq/A0f1vY=; b=gu5+DkK5s1QCZKWcKEQNHF61l257SYpRlL 2k9NPb3+eQg6StEMAn+gpy9UpDcYnE018RSTHSwc4tcZk2dZL8E9Saqv8bCLsBWg ZlxvVol9eA8aDXJ6Jzrgh5G6BiOKNFSUC1+JdSPJzvYPg55DnCcGoBHvGxW1/P9M cWfOoh6mo= Received: from bogon.localdomain (unknown [124.127.58.139]) by gzga-smtp-mtada-g1-4 (Coremail) with SMTP id _____wDXf9ISgjFnSSVMAg--.7385S2; Mon, 11 Nov 2024 12:03:34 +0800 (CST) From: Huichao Cai To: jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com, yanzhirun_163@163.com Cc: dev@dpdk.org, Huichao cai Subject: [PATCH v2] graph: mcore: optimize graph search Date: Mon, 11 Nov 2024 12:03:17 +0800 Message-Id: <1731297797-3662-1-git-send-email-chcchc88@163.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1730966682-2632-1-git-send-email-chcchc88@163.com> References: <1730966682-2632-1-git-send-email-chcchc88@163.com> X-CM-TRANSID: _____wDXf9ISgjFnSSVMAg--.7385S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7uw43ZrWfCrWDuryxZFy5urg_yoW8ZrW5p3 WfKa1fJFW8KF1fKr1vgr4UXFW8t3Z0y39Fgry5WFnxJrZ8Jr13AryxtryUtF43XrW3Ca1x C3y8Jr1UKr1j9a7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRkbbiUUUUU= X-Originating-IP: [124.127.58.139] X-CM-SenderInfo: pfkfuxrfyyqiywtou0bp/xtbBDgWUF2cxejrtPAAAsP 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 From: Huichao cai In the function __rte_graph_mcore_dispatch_sched_node_enqueue, 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