From debeafb3c4d7f334fbf915b105e7a01c4bd9f7aa Mon Sep 17 00:00:00 2001
From: Ali Mohammed <ali.mohammed@hpe.com>
Date: Thu, 26 Jan 2023 11:43:12 +0100
Subject: [PATCH] update numa info of threads

---
 maestro/thread_team.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/maestro/thread_team.c b/maestro/thread_team.c
index 5331e1d7..1ac72483 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");
-- 
GitLab