DPDK patches and discussions
 help / color / mirror / Atom feed
From: Huichao Cai <chcchc88@163.com>
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	[thread overview]
Message-ID: <20241114084519.5128-1-chcchc88@163.com> (raw)
In-Reply-To: <20241113073553.6125-1-chcchc88@163.com>

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 <chcchc88@163.com>
---
 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


  parent reply	other threads:[~2024-11-14  8:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07  8:04 [PATCH] graph: optimize graph search when scheduling nodes Huichao cai
2024-11-07  9:37 ` [EXTERNAL] " Jerin Jacob
2024-11-08  1:39   ` Huichao Cai
2024-11-08 12:22     ` Jerin Jacob
2024-11-08 13:38       ` David Marchand
2024-11-11  5:38         ` Jerin Jacob
2024-11-12  8:51           ` David Marchand
2024-11-12  9:35             ` Jerin Jacob
2024-11-12 12:57               ` Huichao Cai
2024-11-13  9:22               ` Huichao Cai
2024-11-14  7:09                 ` Jerin Jacob
2024-11-11  4:03 ` [PATCH v2] graph: mcore: optimize graph search Huichao Cai
2024-11-11  5:46   ` [EXTERNAL] " Jerin Jacob
2024-11-13  9:19     ` Huichao Cai
2024-11-13  7:35   ` [PATCH v3 1/2] " Huichao Cai
2024-11-13  7:35     ` [PATCH v3 2/2] graph: add alignment to the member of rte_node Huichao Cai
2024-11-14  7:14       ` [EXTERNAL] " Jerin Jacob
2024-11-14  8:45     ` Huichao Cai [this message]
2024-11-14  8:45       ` [PATCH v4 " Huichao Cai
2024-11-14 10:05         ` [EXTERNAL] " Jerin Jacob
2024-11-14 12:06           ` Huichao Cai
2024-11-14 13:04             ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241114084519.5128-1-chcchc88@163.com \
    --to=chcchc88@163.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=yanzhirun_163@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).