aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/threads.h
diff options
context:
space:
mode:
authorColin Tregenza Dancer <ctd@metaswitch.com>2017-09-04 15:27:49 +0100
committerDave Barach <openvpp@barachs.net>2017-09-05 13:33:51 +0000
commit215961829c4ae5f738ffcd01a8d1afcab13bd0e2 (patch)
tree1cd897089bd30491ea362b4e827bd9401f34afae /src/vlib/threads.h
parentf7a55ad74c90928d86f1bbf56590d9571c1b828f (diff)
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>
Diffstat (limited to 'src/vlib/threads.h')
-rw-r--r--src/vlib/threads.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vlib/threads.h b/src/vlib/threads.h
index 572ce77ffcc..c3f1cadee16 100644
--- a/src/vlib/threads.h
+++ b/src/vlib/threads.h
@@ -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)
+ ;
+ }
}
}