summaryrefslogtreecommitdiff
path: root/rts/Weak.h
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2018-03-25 14:04:02 -0400
committerBen Gamari <ben@smart-cactus.org>2018-03-25 14:33:27 -0400
commitf7bbc343a624710ecf8f8f5eda620c4f35c90fc8 (patch)
tree0c409ece9e40aa9e612064ac306d75068ee03b0c /rts/Weak.h
parentcf809950efb744ca884e0e0833a80ffd50527ca1 (diff)
downloadhaskell-f7bbc343a624710ecf8f8f5eda620c4f35c90fc8.tar.gz
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
Diffstat (limited to 'rts/Weak.h')
-rw-r--r--rts/Weak.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/rts/Weak.h b/rts/Weak.h
index ab335424db..fb67981497 100644
--- a/rts/Weak.h
+++ b/rts/Weak.h
@@ -19,5 +19,6 @@ void runCFinalizers(StgCFinalizerList *list);
void runAllCFinalizers(StgWeak *w);
void scheduleFinalizers(Capability *cap, StgWeak *w);
void markWeakList(void);
+bool runSomeFinalizers(bool all);
#include "EndPrivate.h"