diff --git a/maestro/thread_team.c b/maestro/thread_team.c index 5331e1d73fda54c6143b12b427c5477caa13fd85..1ac724838e9193e3f57de4fbc5356bc14a6f8e10 100644 --- a/maestro/thread_team.c +++ b/maestro/thread_team.c @@ -37,7 +37,7 @@ #include "maestro/logging.h" #include "maestro/i_globals.h" #include "maestro/i_maestro_numa.h" - + /* simplify logging */ #define DEBUG(...) LOG_DEBUG(MSTRO_LOG_MODULE_ERL,__VA_ARGS__) #define INFO(...) LOG_INFO(MSTRO_LOG_MODULE_ERL,__VA_ARGS__) @@ -45,6 +45,20 @@ #define ERR(...) LOG_ERR(MSTRO_LOG_MODULE_ERL,__VA_ARGS__) +static inline +mstro_status +erl_thread_team_bind_and_update_numa(struct erl_thread_team_ctx *ctx) +{ + mstro_status status = mstro_numa_bind_thread(ctx->tidprefix); + + #ifdef HAVE_NUMA + /**update numa node*/ + int numa_node = numa_node_of_cpu(mstro_numa_get_cpu(void)); + ctx->numa_node = numa_node; + #endif + + return status; +} /** function that is run inside a thread to pick up and handle messages * (in envelope) from the incoming queue */ @@ -72,7 +86,7 @@ erl_thread_team_threadfun(void *closure) DEBUG("%s handler thread %zu running\n", ctx->tidprefix, ctx->id); /*check thread pinning*/ - s = mstro_numa_bind_thread(ctx->tidprefix); + s = erl_thread_team_bind_and_update_numa(ctx); if(s != MSTRO_OK) { WARN("Failed to pin the thread \n");