Refork worker thread data structures in parallel (VPP-970)

Change the rebuilding of worker thread clone datastructures
to run in parallel on the workers, instead of serially
on main.

Change-Id: Ib76bcfbef1e51f2399972090f4057be7aaa84e08
Signed-off-by: Colin Tregenza Dancer <ctd@metaswitch.com>
This commit is contained in:
Colin Tregenza Dancer
2017-09-04 15:27:49 +01:00
committed by Dave Barach
parent f7a55ad74c
commit 215961829c
3 changed files with 229 additions and 151 deletions

View File

@ -181,6 +181,12 @@ typedef struct vlib_main_t
/* Attempt to do a post-mortem elog dump */
int elog_post_mortem_dump;
/*
* Need to call vlib_worker_thread_node_runtime_update before
* releasing worker thread barrier. Only valid in vlib_global_main.
*/
int need_vlib_worker_thread_node_runtime_update;
} vlib_main_t;
/* Global main structure. */

File diff suppressed because it is too large Load Diff

View File

@ -102,6 +102,7 @@ typedef struct
vlib_thread_registration_t *registration;
u8 *name;
u64 barrier_sync_count;
volatile u32 *node_reforks_required;
long lwp;
int lcore_id;
@ -180,6 +181,7 @@ u32 vlib_frame_queue_main_init (u32 node_index, u32 frame_queue_nelts);
void vlib_worker_thread_barrier_sync (vlib_main_t * vm);
void vlib_worker_thread_barrier_release (vlib_main_t * vm);
void vlib_worker_thread_node_refork (void);
static_always_inline uword
vlib_get_thread_index (void)
@ -369,6 +371,15 @@ vlib_worker_thread_barrier_check (void)
if (CLIB_DEBUG > 0)
vm->parked_at_barrier = 0;
clib_smp_atomic_add (vlib_worker_threads->workers_at_barrier, -1);
if (PREDICT_FALSE (*vlib_worker_threads->node_reforks_required))
{
vlib_worker_thread_node_refork ();
clib_smp_atomic_add (vlib_worker_threads->node_reforks_required,
-1);
while (*vlib_worker_threads->node_reforks_required)
;
}
}
}