X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlib%2Fthreads.c;h=b2a2f6939e6395e5d0395297fa9dbcc4e26c15e8;hb=4a06846dd668d7f687e6770215c38e8feb5f1740;hp=d9d781070a37d0e2b3820511d00e72c9343aa457;hpb=deb6f784edbaddd2e60e0d6ac9927f17c4214ad2;p=vpp.git diff --git a/src/vlib/threads.c b/src/vlib/threads.c index d9d781070a3..b2a2f6939e6 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -255,6 +255,21 @@ vlib_thread_init (vlib_main_t * vm) } avail_cpu = clib_bitmap_set (avail_cpu, tm->main_lcore, 0); + /* + * Determine if the number of workers is greater than 0. + * If so, mark CPU 0 unavailable so workers will be numbered after main. + */ + u32 n_workers = 0; + uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers"); + if (p != 0) + { + vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0]; + int worker_thread_count = tr->count; + n_workers = worker_thread_count; + } + if (tm->skip_cores == 0 && n_workers) + avail_cpu = clib_bitmap_set (avail_cpu, 0, 0); + /* assume that there is socket 0 only if there is no data from sysfs */ if (!tm->cpu_socket_bitmap) tm->cpu_socket_bitmap = clib_bitmap_set (0, 0, 1);