summaryrefslogtreecommitdiffstats
path: root/src/vpp
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-01-21 12:34:55 -0500
committerFlorin Coras <florin.coras@gmail.com>2020-02-05 23:38:56 +0000
commita690fdbfe179e0ea65818c03b52535bf9210efd0 (patch)
tree345200955b873dbc2f5bb6857b1acc7966ffed90 /src/vpp
parent86e8bce44f43c1f3c50a3397f9ab850f484f4cad (diff)
vppinfra: numa vector placement support
Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I7e7d95a089dd849c1f01ecea84529d8dbf239f21
Diffstat (limited to 'src/vpp')
-rw-r--r--src/vpp/api/api.c2
-rw-r--r--src/vpp/vnet/main.c13
2 files changed, 13 insertions, 2 deletions
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c
index 2ed9ceec62c..f652205d583 100644
--- a/src/vpp/api/api.c
+++ b/src/vpp/api/api.c
@@ -273,7 +273,7 @@ get_thread_data (vl_api_thread_data_t * td, int index)
td->pid = htonl (w->lwp);
td->cpu_id = htonl (w->cpu_id);
td->core = htonl (w->core_id);
- td->cpu_socket = htonl (w->socket_id);
+ td->cpu_socket = htonl (w->numa_id);
}
static void
diff --git a/src/vpp/vnet/main.c b/src/vpp/vnet/main.c
index ea8e4f88718..7c7dd9870e9 100644
--- a/src/vpp/vnet/main.c
+++ b/src/vpp/vnet/main.c
@@ -20,6 +20,7 @@
#include <vppinfra/cpu.h>
#include <vlib/vlib.h>
#include <vlib/unix/unix.h>
+#include <vlib/threads.h>
#include <vnet/plugin/plugin.h>
#include <vnet/ethernet/ethernet.h>
#include <vpp/app/version.h>
@@ -107,6 +108,7 @@ main (int argc, char *argv[])
u32 size;
int main_core = 1;
cpu_set_t cpuset;
+ void *main_heap;
#if __x86_64__
CLIB_UNUSED (const char *msg)
@@ -273,8 +275,17 @@ defaulted:
vl_msg_api_set_first_available_msg_id (VL_MSG_FIRST_AVAILABLE);
/* Allocate main heap */
- if (clib_mem_init_thread_safe (0, main_heap_size))
+ if ((main_heap = clib_mem_init_thread_safe (0, main_heap_size)))
{
+ vlib_worker_thread_t tmp;
+
+ /* Figure out which numa runs the main thread */
+ vlib_get_thread_core_numa (&tmp, main_core);
+ __os_numa_index = tmp.numa_id;
+
+ /* and use the main heap as that numa's numa heap */
+ clib_mem_set_per_numa_heap (main_heap);
+
vm->init_functions_called = hash_create (0, /* value bytes */ 0);
vpe_main_init (vm);
return vlib_unix_main (argc, argv);