summaryrefslogtreecommitdiff
path: root/rts/RtsFlags.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2016-06-11 11:07:14 +0100
committerSimon Marlow <marlowsd@gmail.com>2016-06-17 14:52:45 +0100
commit498ed2664219f7e8f1077f46ad2061aba2f57de4 (patch)
tree123f66f55096876114b89876e4adf287ad944818 /rts/RtsFlags.c
parenta7f65b8787b0521397ee09061394425aa69bc6e0 (diff)
downloadhaskell-498ed2664219f7e8f1077f46ad2061aba2f57de4.tar.gz
NUMA cleanups
- Move the numaMap and nNumaNodes out of RtsFlags to Capability.c - Add a test to tests/rts
Diffstat (limited to 'rts/RtsFlags.c')
-rw-r--r--rts/RtsFlags.c36
1 files changed, 4 insertions, 32 deletions
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index 25345bf57b..e23f760f43 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -123,7 +123,6 @@ static void errorRtsOptsDisabled (const char *s);
void initRtsFlagsDefaults(void)
{
- uint32_t i;
StgWord64 maxStkSize = 8 * getPhysicalMemorySize() / 10;
// if getPhysicalMemorySize fails just move along with an 8MB limit
if (maxStkSize == 0)
@@ -160,10 +159,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.GcFlags.heapBase = 0; /* means don't care */
RtsFlags.GcFlags.allocLimitGrace = (100*1024) / BLOCK_SIZE;
RtsFlags.GcFlags.numa = rtsFalse;
- RtsFlags.GcFlags.nNumaNodes = 1;
- for (i = 0; i < MAX_NUMA_NODES; i++) {
- RtsFlags.GcFlags.numaMap[i] = 0;
- }
+ RtsFlags.GcFlags.numaMask = 1;
RtsFlags.DebugFlags.scheduler = rtsFalse;
RtsFlags.DebugFlags.interpreter = rtsFalse;
@@ -776,28 +772,8 @@ error = rtsTrue;
break;
}
- uint32_t nNodes = osNumaNodes();
- if (nNodes > MAX_NUMA_NODES) {
- errorBelch("%s: Too many NUMA nodes (max %d)",
- rts_argv[arg], MAX_NUMA_NODES);
- error = rtsTrue;
- } else {
- RtsFlags.GcFlags.numa = rtsTrue;
- mask = mask & osNumaMask();
- uint32_t logical = 0, physical = 0;
- for (; physical < MAX_NUMA_NODES; physical++) {
- if (mask & 1) {
- RtsFlags.GcFlags.numaMap[logical++] = physical;
- }
- mask = mask >> 1;
- }
- RtsFlags.GcFlags.nNumaNodes = logical;
- if (logical == 0) {
- errorBelch("%s: available node set is empty",
- rts_argv[arg]);
- error = rtsTrue;
- }
- }
+ RtsFlags.GcFlags.numa = rtsTrue;
+ RtsFlags.GcFlags.numaMask = mask;
}
#endif
#if defined(DEBUG) && defined(THREADED_RTS)
@@ -821,11 +797,7 @@ error = rtsTrue;
} else {
RtsFlags.GcFlags.numa = rtsTrue;
RtsFlags.DebugFlags.numa = rtsTrue;
- RtsFlags.GcFlags.nNumaNodes = nNodes;
- uint32_t physical = 0;
- for (; physical < MAX_NUMA_NODES; physical++) {
- RtsFlags.GcFlags.numaMap[physical] = physical;
- }
+ RtsFlags.GcFlags.numaMask = (1<<nNodes) - 1;
}
}
#endif