summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2019-06-06 14:07:06 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2019-06-26 09:02:33 +0100
commit1dc61c1ae7b80822612844d760eaebe6eb1f0ed4 (patch)
tree611b6c733be307a949dc32d5864437a4487dd2ae
parenta196d9c391aa488d58fb3d787637c6c0402958cb (diff)
downloadhaskell-wip/ldv-profile.tar.gz
rts: Do not traverse nursery for dead closures in LDV profilewip/ldv-profile
It is important that `heapCensus` and `LdvCensusForDead` traverse the same areas. `heapCensus` increases the `not_used` counter which tracks how many closures are live but haven't been used yet. `LdvCensusForDead` increases the `void_total` counter which tracks how many dead closures there are. The `LAG` is then calculated by substracting the `void_total` from `not_used` and so it is essential that `not_used >= void_total`. This fact is checked by quite a few assertions. However, if a program has low maximum residency but allocates a lot in the nursery then these assertions were failing (see #16753 and #15903) because `LdvCensusForDead` was observing dead closures from the nursery which totalled more than the `not_used`. The same closures were not counted by `heapCensus`. Therefore, it seems that the correct fix is to make `LdvCensusForDead` agree with `heapCensus` and not traverse the nursery for dead closures. Fixes #16100 #16753 #15903 #8982
-rw-r--r--rts/LdvProfile.c23
1 files changed, 0 insertions, 23 deletions
diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c
index 608961e246..c918be55a8 100644
--- a/rts/LdvProfile.c
+++ b/rts/LdvProfile.c
@@ -173,28 +173,6 @@ processHeapForDead( bdescr *bd )
}
/* --------------------------------------------------------------------------
- * Calls processHeapClosureForDead() on every *dead* closures in the nursery.
- * ----------------------------------------------------------------------- */
-static void
-processNurseryForDead( void )
-{
- StgPtr p;
- bdescr *bd;
-
- if (MainCapability.r.rNursery == NULL)
- return;
-
- for (bd = MainCapability.r.rNursery->blocks; bd != NULL; bd = bd->link) {
- p = bd->start;
- while (p < bd->free) {
- while (p < bd->free && !*p) p++; // skip slop
- if (p >= bd->free) break;
- p += processHeapClosureForDead((StgClosure *)p);
- }
- }
-}
-
-/* --------------------------------------------------------------------------
* Calls processHeapClosureForDead() on every *dead* closures in the closure
* chain.
* ----------------------------------------------------------------------- */
@@ -233,7 +211,6 @@ LdvCensusForDead( uint32_t N )
//
barf("Lag/Drag/Void profiling not supported with -G1");
} else {
- processNurseryForDead();
for (g = 0; g <= N; g++) {
processHeapForDead(generations[g].old_blocks);
processChainForDead(generations[g].large_objects);