[v7,1/1] graph: mcore: optimize graph search
Checks
Commit Message
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 <chcchc88@163.com>
---
devtools/libabigail.abignore | 5 +++++
doc/guides/rel_notes/release_25_03.rst | 1 +
lib/graph/rte_graph_model_mcore_dispatch.c | 11 +++++++----
lib/graph/rte_graph_worker_common.h | 1 +
4 files changed, 14 insertions(+), 4 deletions(-)
Comments
Recheck-request: iol-intel-Performance
Triggering a retest due to testbed instability yesterday.
On Wed, Feb 5, 2025 at 9:53 PM Huichao Cai <chcchc88@163.com> wrote:
> 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 <chcchc88@163.com>
> ---
> devtools/libabigail.abignore | 5 +++++
> doc/guides/rel_notes/release_25_03.rst | 1 +
> lib/graph/rte_graph_model_mcore_dispatch.c | 11 +++++++----
> lib/graph/rte_graph_worker_common.h | 1 +
> 4 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
> index 21b8cd6113..8876aaee2e 100644
> --- a/devtools/libabigail.abignore
> +++ b/devtools/libabigail.abignore
> @@ -33,3 +33,8 @@
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; Temporary exceptions till next major ABI version ;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> +[suppress_type]
> + name = rte_node
> + has_size_change = no
> + has_data_member_inserted_between =
> +{offset_after(original_process), offset_of(xstat_off)}
> \ No newline at end of file
> diff --git a/doc/guides/rel_notes/release_25_03.rst
> b/doc/guides/rel_notes/release_25_03.rst
> index 269ab6f68a..16a888fd19 100644
> --- a/doc/guides/rel_notes/release_25_03.rst
> +++ b/doc/guides/rel_notes/release_25_03.rst
> @@ -150,6 +150,7 @@ ABI Changes
>
> * No ABI change that would break compatibility with 24.11.
>
> +* 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 d3ec88519d..aef0f65673 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;
> };
>
> --
> 2.33.0
>
>
@@ -33,3 +33,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Temporary exceptions till next major ABI version ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+[suppress_type]
+ name = rte_node
+ has_size_change = no
+ has_data_member_inserted_between =
+{offset_after(original_process), offset_of(xstat_off)}
\ No newline at end of file
@@ -150,6 +150,7 @@ ABI Changes
* No ABI change that would break compatibility with 24.11.
+* graph: Added ``graph`` field to the ``dispatch`` structure in the ``rte_node`` structure.
Known Issues
------------
@@ -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;
}
@@ -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;
};