Run interior graph nodes before process nodes 22/14222/2
authorDave Barach <dave@barachs.net>
Tue, 14 Aug 2018 17:47:58 +0000 (13:47 -0400)
committerFlorin Coras <florin.coras@gmail.com>
Tue, 14 Aug 2018 20:19:09 +0000 (20:19 +0000)
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>
src/vlib/main.c

index f9b38b2..6783068 100644 (file)
@@ -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