diff options
author | 2016-04-19 09:38:35 -0400 | |
---|---|---|
committer | 2016-04-19 09:38:53 -0400 | |
commit | dae88b9a53c2bbdc8a60d05efa7e879e2544eb5a (patch) | |
tree | d7e6bb98d02e1c6475543866e9a9b7dff29cbd4d | |
parent | a4f16a0e570e663bdf6285b0ac5c4258fcd9ffd3 (diff) |
VPP-6: set epoll wait-time to zero when binary API messages are waiting
Change-Id: I629ef98ecd3b729d2564b3a1ba8c6039f854f86c
Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r-- | vlib-api/vlibmemory/memory_vlib.c | 2 | ||||
-rw-r--r-- | vlib/vlib/main.h | 3 | ||||
-rw-r--r-- | vlib/vlib/unix/input.c | 8 |
3 files changed, 9 insertions, 4 deletions
diff --git a/vlib-api/vlibmemory/memory_vlib.c b/vlib-api/vlibmemory/memory_vlib.c index 107fddc3..8aa0fe4a 100644 --- a/vlib-api/vlibmemory/memory_vlib.c +++ b/vlib-api/vlibmemory/memory_vlib.c @@ -404,6 +404,7 @@ memclnt_process (vlib_main_t * vm, while (1) { pthread_mutex_lock (&q->mutex); if (q->cursize == 0) { + vm->api_queue_nonempty = 0; pthread_mutex_unlock (&q->mutex); if (TRACE_VLIB_MEMORY_QUEUE) @@ -626,6 +627,7 @@ memclnt_queue_signal (int signum) vlib_main_t * vm = vlib_get_main(); vm->queue_signal_pending = 1; + vm->api_queue_nonempty = 1; } static void diff --git a/vlib/vlib/main.h b/vlib/vlib/main.h index 1a110459..ef36c1e3 100644 --- a/vlib/vlib/main.h +++ b/vlib/vlib/main.h @@ -168,8 +168,9 @@ typedef struct vlib_main_t { vlib_config_function_runtime_t *config_function_registrations; mc_serialize_msg_t *mc_msg_registrations; /* mc_main is a pointer... */ - /* control-plane API queue signal pending */ + /* control-plane API queue signal pending, length indication */ volatile u32 queue_signal_pending; + volatile u32 api_queue_nonempty; void (*queue_signal_callback)(struct vlib_main_t *); u8 **argv; } vlib_main_t; diff --git a/vlib/vlib/unix/input.c b/vlib/vlib/unix/input.c index 62b32544..543e2c00 100644 --- a/vlib/vlib/unix/input.c +++ b/vlib/vlib/unix/input.c @@ -127,10 +127,12 @@ linux_epoll_input (vlib_main_t * vm, if (nm->input_node_counts_by_state[VLIB_NODE_STATE_POLLING] > 0) timeout_ms = 0; - if (vector_rate > 1) + /* + * When busy: don't wait & only epoll for input + * every 1024 times through main loop. + */ + if (vector_rate > 1 || vm->api_queue_nonempty) { - /* When busy don't wait & only epoll for input every 8 times - through main loop. */ timeout_ms = 0; node->input_main_loops_per_call = 1024; } |