[commit: ghc] master: Make it possible to use +RTS -qn without -N (aae2b3d)

git at git.haskell.org git at git.haskell.org
Fri Oct 28 19:16:33 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/aae2b3d522aae49311a9f9c52d40fb58c99eed13/ghc

>---------------------------------------------------------------

commit aae2b3d522aae49311a9f9c52d40fb58c99eed13
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Fri Oct 28 16:34:44 2016 +0100

    Make it possible to use +RTS -qn without -N
    
    It's entirely reasonable to set +RTS -qn without setting -N, because the
    program might later call setNumCapabilities.  If we disallow it, there's
    no way to use -qn on programs that use setNumCapabilities.


>---------------------------------------------------------------

aae2b3d522aae49311a9f9c52d40fb58c99eed13
 rts/RtsFlags.c | 7 -------
 rts/Schedule.c | 6 +++++-
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index d86b154..aeb2fe5 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -1487,13 +1487,6 @@ static void normaliseRtsOpts (void)
             RtsFlags.ParFlags.parGcLoadBalancingGen = 1;
         }
     }
-
-#ifdef THREADED_RTS
-    if (RtsFlags.ParFlags.parGcThreads > RtsFlags.ParFlags.nCapabilities) {
-        errorBelch("GC threads (-qn) must be between 1 and the value of -N");
-        errorUsage();
-    }
-#endif
 }
 
 static void errorUsage (void)
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 06db3fe..a44512b 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -1596,7 +1596,11 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
             // enabled_capabilities may change if requestSync() below fails and
             // we retry.
             if (gc_type == SYNC_GC_PAR && n_gc_threads > 0) {
-                need_idle = stg_max(0, enabled_capabilities - n_gc_threads);
+                if (n_gc_threads >= enabled_capabilities) {
+                    need_idle = 0;
+                } else {
+                    need_idle = enabled_capabilities - n_gc_threads;
+                }
             } else {
                 need_idle = 0;
             }



More information about the ghc-commits mailing list