diff options
author | Douglas Wilson <douglas.wilson@gmail.com> | 2020-12-14 13:55:54 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-01-17 05:49:54 -0500 |
commit | 345ae06b3334a64e9d6db9ea69573ef3227e535a (patch) | |
tree | 55fff9e7dccbaf5b8181ce2534c0624a00a5b161 /rts/sm | |
parent | f2d118c0a018dccd3c82e885f500d4e57ff94f82 (diff) | |
download | haskell-345ae06b3334a64e9d6db9ea69573ef3227e535a.tar.gz |
rts: add max_n_todo_overflow internal counter
I've never observed this counter taking a non-zero value, however I do
think it's existence is justified by the comment in grab_local_todo_block.
I've not added it to RTSStats in GHC.Stats, as it doesn't seem worth the
api churn.
Diffstat (limited to 'rts/sm')
-rw-r--r-- | rts/sm/GC.c | 7 | ||||
-rw-r--r-- | rts/sm/GCThread.h | 1 | ||||
-rw-r--r-- | rts/sm/GCUtils.c | 12 |
3 files changed, 18 insertions, 2 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c index b78f993260..5e986f2296 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -270,7 +270,7 @@ GarbageCollect (uint32_t collect_gen, generation *gen; StgWord live_blocks, live_words, par_max_copied, par_balanced_copied, gc_spin_spin, gc_spin_yield, mut_spin_spin, mut_spin_yield, - any_work, scav_find_work; + any_work, scav_find_work, max_n_todo_overflow; #if defined(THREADED_RTS) gc_thread *saved_gct; #endif @@ -594,6 +594,7 @@ GarbageCollect (uint32_t collect_gen, mut_spin_yield = 0; any_work = 0; scav_find_work = 0; + max_n_todo_overflow = 0; { uint32_t i; uint64_t par_balanced_copied_acc = 0; @@ -625,6 +626,7 @@ GarbageCollect (uint32_t collect_gen, any_work += RELAXED_LOAD(&thread->any_work); scav_find_work += RELAXED_LOAD(&thread->scav_find_work); + max_n_todo_overflow = stg_max(RELAXED_LOAD(&thread->max_n_todo_overflow), max_n_todo_overflow); par_max_copied = stg_max(RELAXED_LOAD(&thread->copied), par_max_copied); par_balanced_copied_acc += @@ -1043,7 +1045,7 @@ GarbageCollect (uint32_t collect_gen, N, n_gc_threads, gc_threads, par_max_copied, par_balanced_copied, gc_spin_spin, gc_spin_yield, mut_spin_spin, mut_spin_yield, - any_work, scav_find_work); + any_work, scav_find_work, max_n_todo_overflow); #if defined(RTS_USER_SIGNALS) if (RtsFlags.MiscFlags.install_signal_handlers) { @@ -1803,6 +1805,7 @@ init_gc_thread (gc_thread *t) t->scanned = 0; t->any_work = 0; t->scav_find_work = 0; + t->max_n_todo_overflow = 0; } /* ----------------------------------------------------------------------------- diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h index 90d15c69c5..31719ca020 100644 --- a/rts/sm/GCThread.h +++ b/rts/sm/GCThread.h @@ -183,6 +183,7 @@ typedef struct gc_thread_ { W_ scanned; W_ any_work; W_ scav_find_work; + W_ max_n_todo_overflow; Time gc_start_cpu; // thread CPU time Time gc_end_cpu; // thread CPU time diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c index 89a92bc837..52ea27f263 100644 --- a/rts/sm/GCUtils.c +++ b/rts/sm/GCUtils.c @@ -183,6 +183,18 @@ push_todo_block(bdescr *bd, gen_workspace *ws) bd->link = ws->todo_overflow; ws->todo_overflow = bd; ws->n_todo_overflow++; + + // In theory, if a gc thread pushes more blocks to it's todo_q than it + // pops, the todo_overflow list will continue to grow. Other gc threads + // can't steal from the todo_overflwo list, so they may be idle as the + // first gc thread works diligently on it's todo_overflow list. In + // practice this has not been observed to occur. + // + // The max_n_todo_overflow counter will allow us to observe large + // todo_overflow lists if they ever arise. As of now I've not observed + // any nonzero max_n_todo_overflow samples. + gct->max_n_todo_overflow = + stg_max(gct->max_n_todo_overflow, ws->n_todo_overflow); } #if defined(THREADED_RTS) |