[commit: ghc] master: Run C finalizers incrementally during mutation (f7bbc34)
git at git.haskell.org
git at git.haskell.org
Sun Mar 25 19:03:34 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f7bbc343a624710ecf8f8f5eda620c4f35c90fc8/ghc
>---------------------------------------------------------------
commit f7bbc343a624710ecf8f8f5eda620c4f35c90fc8
Author: Simon Marlow <marlowsd at gmail.com>
Date: Sun Mar 25 14:04:02 2018 -0400
Run C finalizers incrementally during mutation
With a large heap it's possible to build up a lot of finalizers
between GCs. We've observed GC spending up to 50% of its time running
finalizers. But there's no reason we have to run finalizers during
GC, and especially no reason we have to block *all* the mutator
threads while *one* GC thread runs finalizers one by one.
I thought about a bunch of alternative ways to handle this, which are
documented along with runSomeFinalizers() in Weak.c. The approach I
settled on is to have a capability run finalizers if it is idle. So
running finalizers is like a low-priority background thread. This
requires some minor scheduler changes, but not much. In the future we
might be able to move more GC work into here (I have my eye on freeing
large blocks, for example).
Test Plan:
* validate
* tested on our system and saw reductions in GC pauses of 40-50%.
Reviewers: bgamari, niteria, osa1, erikd
Reviewed By: bgamari, osa1
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4521
>---------------------------------------------------------------
f7bbc343a624710ecf8f8f5eda620c4f35c90fc8
rts/Schedule.c | 14 ++++++-
rts/Weak.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++------
rts/Weak.h | 1 +
rts/sm/GC.c | 25 ++++++++++++
rts/sm/GC.h | 2 +
5 files changed, 149 insertions(+), 12 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f7bbc343a624710ecf8f8f5eda620c4f35c90fc8
More information about the ghc-commits
mailing list