summaryrefslogtreecommitdiff
path: root/rts/Stats.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-11-21 15:12:33 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-11-21 15:12:33 +0000
commit3ebcd3deb769a03f4ded0fca2cf38201048c0214 (patch)
treeba4f0a6fc73550425a0db988bf4fbb9651d110aa /rts/Stats.c
parentc373ebdb90edee470ad6fa8277cbe7aa369f23f8 (diff)
downloadhaskell-3ebcd3deb769a03f4ded0fca2cf38201048c0214.tar.gz
Use mutator threads to do GC, instead of having a separate pool of GC threads
Previously, the GC had its own pool of threads to use as workers when doing parallel GC. There was a "leader", which was the mutator thread that initiated the GC, and the other threads were taken from the pool. This was simple and worked fine for sequential programs, where we did most of the benchmarking for the parallel GC, but falls down for parallel programs. When we have N mutator threads and N cores, at GC time we would have to stop N-1 mutator threads and start up N-1 GC threads, and hope that the OS schedules them all onto separate cores. It practice it doesn't, as you might expect. Now we use the mutator threads to do GC. This works quite nicely, particularly for parallel programs, where each mutator thread scans its own spark pool, which is probably in its cache anyway. There are some flag changes: -g<n> is removed (-g1 is still accepted for backwards compat). There's no way to have a different number of GC threads than mutator threads now. -q1 Use one OS thread for GC (turns off parallel GC) -qg<n> Use parallel GC for generations >= <n> (default: 1) Using parallel GC only for generations >=1 works well for sequential programs. Compiling an ordinary sequential program with -threaded and running it with -N2 or more should help if you do a lot of GC. I've found that adding -qg0 (do parallel GC for generation 0 too) speeds up some parallel programs, but slows down some sequential programs. Being conservative, I left the threshold at 1. ToDo: document the new options.
Diffstat (limited to 'rts/Stats.c')
-rw-r--r--rts/Stats.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rts/Stats.c b/rts/Stats.c
index 228f0c021e..9c17856970 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -613,11 +613,11 @@ stat_exit(int alloc)
}
#if defined(THREADED_RTS)
- if (RtsFlags.ParFlags.gcThreads > 1) {
+ if (RtsFlags.ParFlags.parGcEnabled) {
statsPrintf("\n Parallel GC work balance: %.2f (%ld / %ld, ideal %d)\n",
(double)GC_par_avg_copied / (double)GC_par_max_copied,
(lnat)GC_par_avg_copied, (lnat)GC_par_max_copied,
- RtsFlags.ParFlags.gcThreads
+ RtsFlags.ParFlags.nNodes
);
}
#endif