summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
059d1d0)
Change-Id: Id3ccfcfa2a88cf7aa106f1202af7cd677de32575
Signed-off-by: Damjan Marion <damarion@cisco.com>
avail_cpu = clib_bitmap_dup (tm->cpu_core_bitmap);
avail_cpu = clib_bitmap_dup (tm->cpu_core_bitmap);
- /* by default we skip core 0, unless it is the only one available */
- if (tm->skip_cores == ~0)
- tm->skip_cores = (clib_bitmap_count_set_bits (avail_cpu) < 2) ? 0 : 1;
-
/* skip cores */
for (i = 0; i < tm->skip_cores; i++)
{
/* skip cores */
for (i = 0; i < tm->skip_cores; i++)
{
}
/* grab cpu for main thread */
}
/* grab cpu for main thread */
+ if (tm->main_lcore == ~0)
- tm->main_lcore = clib_bitmap_first_set (avail_cpu);
+ /* if main-lcore is not set, we try to use lcore 1 */
+ if (clib_bitmap_get (avail_cpu, 1))
+ tm->main_lcore = 1;
+ else
+ tm->main_lcore = clib_bitmap_first_set (avail_cpu);
if (tm->main_lcore == (u8) ~ 0)
return clib_error_return (0, "no available cpus to be used for the"
" main thread");
if (tm->main_lcore == (u8) ~ 0)
return clib_error_return (0, "no available cpus to be used for the"
" main thread");
{
tm->cb.vlib_thread_set_lcore_cb (0, tm->main_lcore);
}
{
tm->cb.vlib_thread_set_lcore_cb (0, tm->main_lcore);
}
+ else
+ {
+ cpu_set_t cpuset;
+ CPU_ZERO (&cpuset);
+ CPU_SET (tm->main_lcore, &cpuset);
+ pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+ }
/* as many threads as stacks... */
vec_validate_aligned (vlib_worker_threads, vec_len (vlib_thread_stacks) - 1,
/* as many threads as stacks... */
vec_validate_aligned (vlib_worker_threads, vec_len (vlib_thread_stacks) - 1,
tm->n_thread_stacks = 1; /* account for main thread */
tm->sched_policy = ~0;
tm->sched_priority = ~0;
tm->n_thread_stacks = 1; /* account for main thread */
tm->sched_policy = ~0;
tm->sched_priority = ~0;
u8 *thread_prefix;
/* main thread lcore */
u8 *thread_prefix;
/* main thread lcore */
/* Bitmap of available CPU cores */
uword *cpu_core_bitmap;
/* Bitmap of available CPU cores */
uword *cpu_core_bitmap;
## Manual pinning of thread(s) to CPU core(s)
## Manual pinning of thread(s) to CPU core(s)
- ## Set logical CPU core where main thread runs
+ ## Set logical CPU core where main thread runs, if main core is not set
+ ## VPP will use core 1 if available
# main-core 1
## Set logical CPU core(s) where worker threads are running
# main-core 1
## Set logical CPU core(s) where worker threads are running