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 7717245D01; Thu, 14 Nov 2024 09:45:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 48BCA42D76; Thu, 14 Nov 2024 09:45:36 +0100 (CET) Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4]) by mails.dpdk.org (Postfix) with ESMTP id B002442D6A for ; Thu, 14 Nov 2024 09:45:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=IyPCq ONTV3j2pF4NBt++MrMARZ/hItV2Jki2luhYXmM=; b=qZRMXet83xLwINc36qSo9 JyfLgaV9tVp6Ke2sk8JgJQYXXKUqfH/LVjtZa96QBHFTvDYfhWIXGSlSeMLOn8a8 C8WaowuSJFhI+23r3yQQP4rOD7OzTm0N/iyJ4Y+grSxamR7vxo6iUylBYy+GoxVX OdZVjIpBqktCnhiqlW1dsg= Received: from localhost.localdomain (unknown [124.127.58.139]) by gzsmtp5 (Coremail) with SMTP id QCgvCgDXv9yruDVn2cSZDg--.24474S2; Thu, 14 Nov 2024 16:45:32 +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 v4 1/2] graph: mcore: optimize graph search Date: Thu, 14 Nov 2024 16:45:18 +0800 Message-Id: <20241114084519.5128-1-chcchc88@163.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20241113073553.6125-1-chcchc88@163.com> References: <20241113073553.6125-1-chcchc88@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: QCgvCgDXv9yruDVn2cSZDg--.24474S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxZF1rAr15AFy7ArykJw18Zrb_yoW5XrWrp3 Z5Kay3AFWDKF1rKr1IqF4UXrWrJ3WDt39Fgry8W34xXrs3Jr17Zry8Jry3tF43XrWfCa1x uw4jqryUCr1j937anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07ULYFtUUUUU= X-Originating-IP: [124.127.58.139] X-CM-SenderInfo: pfkfuxrfyyqiywtou0bp/1tbiLgiXF2c1orARaQABsf 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_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. Due to the addition of a "graph" field in the "rte_node" structure, update file release_24_11.rst. Signed-off-by: Huichao Cai --- doc/guides/rel_notes/release_24_11.rst | 1 + lib/graph/rte_graph_model_mcore_dispatch.c | 11 +++++++---- lib/graph/rte_graph_worker_common.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index 9dc739c4cb..592116b979 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -423,6 +423,7 @@ ABI Changes added new structure ``rte_node_xstats`` to ``rte_node_register`` and added ``xstat_off`` to ``rte_node``. +* graph: added ``graph`` field to the ``dispatch`` structure in the ``rte_node`` structure. Known Issues ------------ diff --git a/lib/graph/rte_graph_model_mcore_dispatch.c b/lib/graph/rte_graph_model_mcore_dispatch.c index a590fc9497..a81d338227 100644 --- a/lib/graph/rte_graph_model_mcore_dispatch.c +++ b/lib/graph/rte_graph_model_mcore_dispatch.c @@ -118,11 +118,14 @@ __rte_graph_mcore_dispatch_sched_node_enqueue(struct rte_node *node, 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 a518af2b2a..4c2432b47f 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. */ -- 2.27.0