summaryrefslogtreecommitdiff
path: root/rts/Task.c
diff options
context:
space:
mode:
authorDarshan Kapashi <darshankapashi@gmail.com>2016-11-10 15:21:08 -0500
committerBen Gamari <ben@smart-cactus.org>2016-11-10 15:25:40 -0500
commit122d826d1d1b7ba6e73866331863fa1e0b3e99ea (patch)
tree77c2167cbe4ad0b48c64ae60aa82bc654ad9088e /rts/Task.c
parentbef7e784d037f720697a215b9e21f13b385e6d3e (diff)
downloadhaskell-122d826d1d1b7ba6e73866331863fa1e0b3e99ea.tar.gz
rts: Add api to pin a thread to a numa node but without fixing a capability
`rts_setInCallCapability` sets the thread affinity as well as pins the numa node. We should also have the ability to set the numa node without setting the capability affinity. `rts_pinNumaNodeForCapability` function is added and exported via `RtsAPI.h`. Previous callers of `rts_setInCallCapability` should now also call `rts_pinNumaNodeForCapability` to get the same effect as before. Test Plan: ./validate Reviewers: austin, simonmar, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie, niteria Differential Revision: https://phabricator.haskell.org/D2637 GHC Trac Issues: #12764
Diffstat (limited to 'rts/Task.c')
-rw-r--r--rts/Task.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/rts/Task.c b/rts/Task.c
index 253520f909..8ce4eccdb1 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -506,11 +506,19 @@ void rts_setInCallCapability (
if (RtsFlags.ParFlags.setAffinity) {
setThreadAffinity(preferred_capability, n_capabilities);
}
- if (RtsFlags.GcFlags.numa) {
- task->node = capNoToNumaNode(preferred_capability);
- if (!DEBUG_IS_ON || !RtsFlags.DebugFlags.numa) { // faking NUMA
- setThreadNode(numa_map[task->node]);
- }
+ }
+#endif
+}
+
+void rts_pinThreadToNumaNode (
+ int node USED_IF_THREADS)
+{
+#ifdef THREADED_RTS
+ if (RtsFlags.GcFlags.numa) {
+ Task *task = getTask();
+ task->node = capNoToNumaNode(node);
+ if (!DEBUG_IS_ON || !RtsFlags.DebugFlags.numa) { // faking NUMA
+ setThreadNode(numa_map[task->node]);
}
}
#endif