summaryrefslogtreecommitdiff
path: root/rts/sm/GC.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2016-04-09 20:45:50 +0100
committerSimon Marlow <smarlow@fb.com>2016-05-04 05:30:30 -0700
commit76ee260778991367b8dbf07ecf7afd31f826c824 (patch)
treefbddddf878413dab3c01abf8108c26d2bd20db4c /rts/sm/GC.c
parentf9d93751126e58fb990335095e02fd81a3595fde (diff)
downloadhaskell-76ee260778991367b8dbf07ecf7afd31f826c824.tar.gz
Allow limiting the number of GC threads (+RTS -qn<n>)
This allows the GC to use fewer threads than the number of capabilities. At each GC, we choose some of the capabilities to be "idle", which means that the thread running on that capability (if any) will sleep for the duration of the GC, and the other threads will do its work. We choose capabilities that are already idle (if any) to be the idle capabilities. The idea is that this helps in the following situation: * We want to use a large -N value so as to make use of hyperthreaded cores * We use a large heap size, so GC is infrequent * But we don't want to use all -N threads in the GC, because that thrashes the memory too much. See docs for usage.
Diffstat (limited to 'rts/sm/GC.c')
-rw-r--r--rts/sm/GC.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index df73ab8314..d3f3ab0166 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -619,8 +619,7 @@ GarbageCollect (nat collect_gen,
live_words += genLiveWords(gen);
live_blocks += genLiveBlocks(gen);
- // add in the partial blocks in the gen_workspaces, but ignore gen 0
- // if this is a local GC (we can't count another capability's part_list)
+ // add in the partial blocks in the gen_workspaces
{
nat i;
for (i = 0; i < n_capabilities; i++) {
@@ -1071,7 +1070,6 @@ waitForGcThreads (Capability *cap USED_IF_THREADS)
stat_startGCSync(gc_threads[cap->no]);
-
while(retry) {
for (i=0; i < n_threads; i++) {
if (i == me || gc_threads[i]->idle) continue;