aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/main.c6
-rw-r--r--src/vlib/main.h2
-rw-r--r--src/vlib/threads.c3
-rwxr-xr-xsrc/vlib/unix/main.c3
4 files changed, 9 insertions, 5 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c
index 3048a0d72de..cfd23859210 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -1696,6 +1696,12 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
{
vlib_node_runtime_t *n;
+ if (PREDICT_FALSE (vm->cpu_id != clib_get_current_cpu_id ()))
+ {
+ vm->cpu_id = clib_get_current_cpu_id ();
+ vm->numa_node = clib_get_current_numa_node ();
+ }
+
if (PREDICT_FALSE (_vec_len (vm->pending_rpc_requests) > 0))
{
if (!is_main)
diff --git a/src/vlib/main.h b/src/vlib/main.h
index 4c6d0f490dd..c6786d8f788 100644
--- a/src/vlib/main.h
+++ b/src/vlib/main.h
@@ -176,7 +176,7 @@ typedef struct vlib_main_t
/* thread, cpu and numa_node indices */
u32 thread_index;
- u32 cpu_index;
+ u32 cpu_id;
u32 numa_node;
/* List of init functions to call, setup by constructors */
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index e6ac6db543a..6257bb64c90 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -1723,8 +1723,7 @@ vlib_worker_thread_fn (void *arg)
ASSERT (vm->thread_index == vlib_get_thread_index ());
- vm->cpu_index = clib_get_current_cpu_index ();
- vm->numa_node = clib_get_current_numa_node ();
+ vm->cpu_id = ~0;
vlib_worker_thread_init (w);
clib_time_init (&vm->clib_time);
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c
index 4d6519ed857..ae92d93adc2 100755
--- a/src/vlib/unix/main.c
+++ b/src/vlib/unix/main.c
@@ -671,8 +671,7 @@ vlib_unix_main (int argc, char *argv[])
__os_thread_index = 0;
vm->thread_index = 0;
- vm->cpu_index = clib_get_current_cpu_index ();
- vm->numa_node = clib_get_current_numa_node ();
+ vm->cpu_id = ~0;
i = clib_calljmp (thread0, (uword) vm,
(void *) (vlib_thread_stacks[0] +