aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-01-28 13:41:27 +0100
committerDamjan Marion <damarion@cisco.com>2019-01-28 13:44:37 +0100
commit29c0b334010a9f8f85212ab55a5f4cf8c8ce3195 (patch)
tree654025d07dbf70f9ea75ffe81a7f0e3f9be0cb97
parentee721412ebd3434bc6dd60f5a78f53a4f6e97667 (diff)
Less intrusive way to capture numa_node and cpu_id changes
Change-Id: I3a33fb81f31ed473811e9e7a6197b81135913865 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/vlib/main.c9
-rw-r--r--src/vlib/threads.c2
-rw-r--r--src/vlib/unix/input.c12
-rwxr-xr-xsrc/vlib/unix/main.c1
4 files changed, 13 insertions, 11 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c
index cfd23859210..a64a991d438 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -1682,6 +1682,9 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
if (!nm->interrupt_threshold_vector_length)
nm->interrupt_threshold_vector_length = 5;
+ vm->cpu_id = clib_get_current_cpu_id ();
+ vm->numa_node = clib_get_current_numa_node ();
+
/* Start all processes. */
if (is_main)
{
@@ -1696,12 +1699,6 @@ 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/threads.c b/src/vlib/threads.c
index 6257bb64c90..ed1ba61a0cc 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -1723,8 +1723,6 @@ vlib_worker_thread_fn (void *arg)
ASSERT (vm->thread_index == vlib_get_thread_index ());
- vm->cpu_id = ~0;
-
vlib_worker_thread_init (w);
clib_time_init (&vm->clib_time);
clib_mem_set_heap (w->thread_mheap);
diff --git a/src/vlib/unix/input.c b/src/vlib/unix/input.c
index 8be0770bfd3..6b519e5ce95 100644
--- a/src/vlib/unix/input.c
+++ b/src/vlib/unix/input.c
@@ -223,12 +223,13 @@ linux_epoll_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
em->epoll_events,
vec_len (em->epoll_events), timeout_ms);
}
+
}
else
{
if (timeout_ms)
usleep (timeout_ms * 1000);
- return 0;
+ goto done;
}
}
@@ -238,7 +239,7 @@ linux_epoll_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_panic_with_error (vm, clib_error_return_unix (0, "epoll_wait"));
/* non fatal error (e.g. EINTR). */
- return 0;
+ goto done;
}
em->epoll_waits += 1;
@@ -314,6 +315,13 @@ linux_epoll_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
}
}
+done:
+ 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 ();
+ }
+
return 0;
}
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c
index ae92d93adc2..08f0506fbc2 100755
--- a/src/vlib/unix/main.c
+++ b/src/vlib/unix/main.c
@@ -671,7 +671,6 @@ vlib_unix_main (int argc, char *argv[])
__os_thread_index = 0;
vm->thread_index = 0;
- vm->cpu_id = ~0;
i = clib_calljmp (thread0, (uword) vm,
(void *) (vlib_thread_stacks[0] +