diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-09-07 17:01:24 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-09-18 14:51:04 +0100 |
commit | 027a654c2003569a6fb74f86a9548101ecd1ffa9 (patch) | |
tree | 4089c5b8792c705dde5b519e145d325c370da573 /rts/sm/GC.c | |
parent | 9615222985f40b62410e1ccc7b6e8581c2729150 (diff) | |
download | haskell-027a654c2003569a6fb74f86a9548101ecd1ffa9.tar.gz |
Small parallel GC improvement
Overlap the main thread's clearNursery() with the other threads.
Diffstat (limited to 'rts/sm/GC.c')
-rw-r--r-- | rts/sm/GC.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 7bdaef5868..93606451cf 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -404,6 +404,10 @@ GarbageCollect (nat collect_gen, break; } + if (n_gc_threads != 1) { + gct->allocated = clearNursery(cap); + } + shutdown_gc_threads(gct->thread_index); // Now see which stable names are still alive. @@ -636,9 +640,15 @@ GarbageCollect (nat collect_gen, allocated += clearNursery(&capabilities[n]); } } else { - gct->allocated = clearNursery(cap); + // When doing parallel GC, clearNursery() is called by the + // worker threads, and the value returned is stored in + // gct->allocated. for (n = 0; n < n_capabilities; n++) { - allocated += gc_threads[n]->allocated; + if (gc_threads[n]->idle) { + allocated += clearNursery(&capabilities[n]); + } else { + allocated += gc_threads[n]->allocated; + } } } |