aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-08-14 13:47:58 -0400
committerFlorin Coras <florin.coras@gmail.com>2018-08-14 20:19:09 +0000
commite3248989586ade29baba635aae66b06995917221 (patch)
treeb0539e3142903df8bd439f8e139840da32764d07
parentacc1fbcb5e13961c1fcf1a00952b19b154b296b6 (diff)
Run interior graph nodes before process nodes
Reduces the chance of tripping over vectors in flight, especially in single-core cases. Change-Id: I132cdd3689f8e634f9a983af57219503817b8560 Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r--src/vlib/main.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c
index f9b38b27061..6783068b42b 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -1547,6 +1547,13 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
}
}
}
+ /* Input nodes may have added work to the pending vector.
+ Process pending vector until there is nothing left.
+ All pending vectors will be processed from input -> output. */
+ for (i = 0; i < _vec_len (nm->pending_frames); i++)
+ cpu_time_now = dispatch_pending_node (vm, i, cpu_time_now);
+ /* Reset pending vector for next iteration. */
+ _vec_len (nm->pending_frames) = 0;
if (is_main)
{
@@ -1565,7 +1572,6 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
{
uword i;
- processes_timing_wheel_data:
for (i = 0; i < _vec_len (nm->data_from_advancing_timing_wheel);
i++)
{
@@ -1608,19 +1614,6 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
_vec_len (nm->data_from_advancing_timing_wheel) = 0;
}
}
-
- /* Input nodes may have added work to the pending vector.
- Process pending vector until there is nothing left.
- All pending vectors will be processed from input -> output. */
- for (i = 0; i < _vec_len (nm->pending_frames); i++)
- cpu_time_now = dispatch_pending_node (vm, i, cpu_time_now);
- /* Reset pending vector for next iteration. */
- _vec_len (nm->pending_frames) = 0;
-
- /* Pending internal nodes may resume processes. */
- if (is_main && _vec_len (nm->data_from_advancing_timing_wheel) > 0)
- goto processes_timing_wheel_data;
-
vlib_increment_main_loop_counter (vm);
/* Record time stamp in case there are no enabled nodes and above