[commit: ghc] master: rts: Throw better error if --numa is used without libnuma support (6462d90)
git at git.haskell.org
git at git.haskell.org
Thu May 3 19:22:11 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/6462d90d01bcb07b8bff63689e8f2c8c20044952/ghc
>---------------------------------------------------------------
commit 6462d90d01bcb07b8bff63689e8f2c8c20044952
Author: Ben Gamari <bgamari.foss at gmail.com>
Date: Thu May 3 12:42:24 2018 -0400
rts: Throw better error if --numa is used without libnuma support
Test Plan: Validate, run program with `+RTS --numa` without libnuma
support compiled in
Reviewers: erikd, simonmar
Subscribers: thomie, carter
GHC Trac Issues: #14956
Differential Revision: https://phabricator.haskell.org/D4556
>---------------------------------------------------------------
6462d90d01bcb07b8bff63689e8f2c8c20044952
rts/RtsFlags.c | 6 ++++++
rts/posix/OSMem.c | 9 +++++++++
rts/sm/OSMem.h | 1 +
rts/win32/OSMem.c | 5 +++++
4 files changed, 21 insertions(+)
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index 461c416..7c292d2 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -906,6 +906,12 @@ error = true;
}
#if defined(THREADED_RTS)
else if (!strncmp("numa", &rts_argv[arg][2], 4)) {
+ if (!osBuiltWithNumaSupport()) {
+ errorBelch("%s: This GHC build was compiled without NUMA support.",
+ rts_argv[arg]);
+ error = true;
+ break;
+ }
OPTION_SAFE;
StgWord mask;
if (rts_argv[arg][6] == '=') {
diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c
index f603644..9ecd53e 100644
--- a/rts/posix/OSMem.c
+++ b/rts/posix/OSMem.c
@@ -591,6 +591,15 @@ void osReleaseHeapMemory(void)
#endif
+bool osBuiltWithNumaSupport(void)
+{
+#if HAVE_LIBNUMA
+ return true;
+#else
+ return false;
+#endif
+}
+
bool osNumaAvailable(void)
{
#if HAVE_LIBNUMA
diff --git a/rts/sm/OSMem.h b/rts/sm/OSMem.h
index 3b0cee9..7dd0efd 100644
--- a/rts/sm/OSMem.h
+++ b/rts/sm/OSMem.h
@@ -18,6 +18,7 @@ void osFreeAllMBlocks(void);
size_t getPageSize (void);
StgWord64 getPhysicalMemorySize (void);
void setExecutable (void *p, W_ len, bool exec);
+bool osBuiltWithNumaSupport(void); // See #14956
bool osNumaAvailable(void);
uint32_t osNumaNodes(void);
uint64_t osNumaMask(void);
diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c
index d05151c..c62ee3b 100644
--- a/rts/win32/OSMem.c
+++ b/rts/win32/OSMem.c
@@ -499,6 +499,11 @@ void osReleaseHeapMemory (void)
#endif
+bool osBuiltWithNumaSupport(void)
+{
+ return true;
+}
+
bool osNumaAvailable(void)
{
return osNumaNodes() > 1;
More information about the ghc-commits
mailing list