summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Wilson <douglas.wilson@gmail.com>2022-06-21 09:28:10 +0100
committerDouglas Wilson <douglas.wilson@gmail.com>2022-06-28 12:16:12 +0000
commite4853277b41c9bd24d25c54adc90869c99f9e3ac (patch)
treeb9ea12dfe9567ec1986eb09b6a3595e5db00686e
parent16b9100c9ef6b34b88a52b3b9e663dd40abd028f (diff)
downloadhaskell-wip/dougwilson-21745.tar.gz
rts: gc stats: account properly for copied bytes in sequential collectionswip/dougwilson-21745
We were not updating the [copied,any_work,scav_find_work, max_n_todo_overflow] counters during sequential collections. As well, we were double counting for parallel collections. To fix this we add an `else` clause to the `if (is_par_gc())`. The par_* counters do not need to be updated in the sequential case because they must be 0.
-rw-r--r--docs/users_guide/9.6.1-notes.rst6
-rw-r--r--rts/sm/GC.c7
2 files changed, 13 insertions, 0 deletions
diff --git a/docs/users_guide/9.6.1-notes.rst b/docs/users_guide/9.6.1-notes.rst
index 04ea0e3bd2..d1eb93aef9 100644
--- a/docs/users_guide/9.6.1-notes.rst
+++ b/docs/users_guide/9.6.1-notes.rst
@@ -66,6 +66,12 @@ Compiler
- The :extension:`TypeInType` is now marked as deprecated. Its meaning has been included
in :extension:`PolyKinds` and :extension:`DataKinds`.
+Runtime System
+~~~~~~~~~~~~~~
+
+- Summary statistics, i.e. the output of :rts-flag:`-s [⟨file⟩]`, now correctly
+ accounts for bytes copied during sequential collections.
+
``base`` library
~~~~~~~~~~~~~~~~
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 22b29cf48d..e60fb314d8 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -170,6 +170,9 @@ is requested it takes 1, when a SYNC_GC_PAR is requested it takes n_capabilities
Clearly this is in need of some tidying up, but for now we tread carefully. We
call is_par_gc() to see whether we are in a parallel or sequential collection.
+If we are in a parallel collection we iterate over gc_threads, being careful to
+account for idle caps. If we are in a sequential collection we deal only with
+the thread local gct.
Of course this is valid only inside GarbageCollect ().
Omitting this check has led to issues such as #19147.
@@ -652,7 +655,11 @@ GarbageCollect (uint32_t collect_gen,
par_balanced_copied =
(par_balanced_copied_acc - copied + other_active_threads / 2) /
other_active_threads;
+ } else {
copied += gct->copied;
+ any_work += gct->any_work;
+ scav_find_work += gct->scav_find_work;
+ max_n_todo_overflow += gct->max_n_todo_overflow;
}
}