diff options
Diffstat (limited to 'rts/posix/OSThreads.c')
-rw-r--r-- | rts/posix/OSThreads.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index ad138d314d..72538c1bf3 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -70,6 +70,10 @@ # include <signal.h> #endif +#ifdef HAVE_NUMA_H +#include <numa.h> +#endif + /* * This (allegedly) OS threads independent layer was initially * abstracted away from code that used Pthreads, so the functions @@ -308,10 +312,32 @@ setThreadAffinity(uint32_t n, uint32_t m) #else void -setThreadAffinity (uint32_t n GNUC3_ATTRIBUTE(__unused__), - uint32_t m GNUC3_ATTRIBUTE(__unused__)) +setThreadAffinity (uint32_t n STG_UNUSED, + uint32_t m STG_UNUSED) +{ +} +#endif + +#ifdef HAVE_NUMA_H +void setThreadNode (uint32_t node) { + ASSERT(node < RtsFlags.GcFlags.nNumaNodes); + if (numa_run_on_node(node) == -1) { + sysErrorBelch("numa_run_on_node"); + stg_exit(1); + } +} + +void releaseThreadNode (void) +{ + if (numa_run_on_node(-1) == -1) { + sysErrorBelch("numa_run_on_node"); + stg_exit(1); + } } +#else +void setThreadNode (uint32_t node STG_UNUSED) { /* nothing */ } +void releaseThreadNode (void) { /* nothing */ } #endif void |