diff options
author | Dave Barach <dbarach@cisco.com> | 2019-03-11 09:57:38 -0400 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-03-12 19:09:47 +0000 |
commit | 80965f599aa90288c8c139e7e3a31726b89eb9a4 (patch) | |
tree | 3348fcd6811634676a4159cd0b4512f0bd1b91ea /src/vlib | |
parent | 26ea14eeade802b8b4993f60506f2b5c9b976433 (diff) |
Perf tune handoff queue polling
Change-Id: I5cfa0f6eee67156bf87907fcf8a39f16d68a0905
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlib')
-rw-r--r-- | src/vlib/buffer_node.h | 2 | ||||
-rw-r--r-- | src/vlib/main.c | 23 | ||||
-rw-r--r-- | src/vlib/main.h | 3 |
3 files changed, 25 insertions, 3 deletions
diff --git a/src/vlib/buffer_node.h b/src/vlib/buffer_node.h index 7e488783fc5..5ded5066563 100644 --- a/src/vlib/buffer_node.h +++ b/src/vlib/buffer_node.h @@ -507,7 +507,6 @@ vlib_buffer_enqueue_to_thread (vlib_main_t * vm, u32 frame_queue_index, if (next_thread_index != current_thread_index) { - if (drop_on_congestion && is_vlib_frame_queue_congested (frame_queue_index, next_thread_index, fqm->queue_hi_thresh, @@ -518,6 +517,7 @@ vlib_buffer_enqueue_to_thread (vlib_main_t * vm, u32 frame_queue_index, n_drop++; goto next; } + vlib_mains[next_thread_index]->check_frame_queues = 1; if (hf) hf->n_vectors = VLIB_FRAME_SIZE - n_left_to_next_thread; diff --git a/src/vlib/main.c b/src/vlib/main.c index 4dcf63e0f9c..c80aa5ab192 100644 --- a/src/vlib/main.c +++ b/src/vlib/main.c @@ -1679,6 +1679,7 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main) u64 cpu_time_now; vlib_frame_queue_main_t *fqm; u32 *last_node_runtime_indices = 0; + u32 frame_queue_check_counter = 0; /* Initialize pending node vector. */ if (is_main) @@ -1734,8 +1735,26 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main) if (!is_main) { vlib_worker_thread_barrier_check (); - vec_foreach (fqm, tm->frame_queue_mains) - vlib_frame_queue_dequeue (vm, fqm); + if (PREDICT_FALSE (vm->check_frame_queues + + frame_queue_check_counter)) + { + u32 processed = 0; + + if (vm->check_frame_queues) + { + frame_queue_check_counter = 100; + vm->check_frame_queues = 0; + } + + vec_foreach (fqm, tm->frame_queue_mains) + processed += vlib_frame_queue_dequeue (vm, fqm); + + /* No handoff queue work found? */ + if (processed) + frame_queue_check_counter = 100; + else + frame_queue_check_counter--; + } if (PREDICT_FALSE (vm->worker_thread_main_loop_callback != 0)) ((void (*)(vlib_main_t *)) vm->worker_thread_main_loop_callback) (vm); diff --git a/src/vlib/main.h b/src/vlib/main.h index 2c5bb45417f..d2c42135d88 100644 --- a/src/vlib/main.h +++ b/src/vlib/main.h @@ -236,6 +236,9 @@ typedef struct vlib_main_t /* Earliest barrier can be closed again */ f64 barrier_no_close_before; + /* Need to check the frame queues */ + volatile uword check_frame_queues; + /* RPC requests, main thread only */ uword *pending_rpc_requests; uword *processing_rpc_requests; |