aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-12-09 18:24:21 +0100
committerDamjan Marion <dmarion@me.com>2022-04-14 19:20:43 +0000
commit8b153de6cdd8d87ae38447487565b346e735dc86 (patch)
tree1d1a77b6e3949815abee01668cba360372293078 /src/vpp
parentaad4298df0d31abe15ac40d0560b0bf196d6c1b5 (diff)
vlib: disable cpu pinning if not configured
In some environment like when running a lot of functional tests, it can be useful to run more VPP instances than CPU and let the Linux scheduler decide what to do. This change disable cpu pinning altogether in the single-threaded case, provided that no main-core is explicitely specified in the config Type: improvement Change-Id: I8c2f36fdd49c00f9adaaeb4c81aefb27c3420a9b Signed-off-by: Benoît Ganne <bganne@cisco.com> Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
Diffstat (limited to 'src/vpp')
-rw-r--r--src/vpp/vnet/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/vpp/vnet/main.c b/src/vpp/vnet/main.c
index e9cef5e76a8..f7e5382f893 100644
--- a/src/vpp/vnet/main.c
+++ b/src/vpp/vnet/main.c
@@ -112,7 +112,7 @@ main (int argc, char *argv[])
clib_mem_page_sz_t default_log2_hugepage_sz = CLIB_MEM_PAGE_SZ_UNKNOWN;
unformat_input_t input, sub_input;
u8 *s = 0, *v = 0;
- int main_core = 1;
+ int main_core = ~0;
cpu_set_t cpuset;
void *main_heap;
@@ -316,9 +316,12 @@ defaulted:
unformat_free (&input);
/* set process affinity for main thread */
- CPU_ZERO (&cpuset);
- CPU_SET (main_core, &cpuset);
- pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+ if (main_core != ~0)
+ {
+ CPU_ZERO (&cpuset);
+ CPU_SET (main_core, &cpuset);
+ pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+ }
/* Set up the plugin message ID allocator right now... */
vl_msg_api_set_first_available_msg_id (VL_MSG_MEMCLNT_LAST + 1);