regions BGC work (#46972)
authorMaoni Stephens <Maoni0@users.noreply.github.com>
Fri, 15 Jan 2021 00:33:51 +0000 (16:33 -0800)
committerGitHub <noreply@github.com>
Fri, 15 Jan 2021 00:33:51 +0000 (16:33 -0800)
commit0fb9c0090e816a467cc42581f4f2f07e15617d94
tree37195733779b502a2dc56db2153f9adcd2181dc7
parente3247adc4a81a55add33541e6bfc2ff74e261e41
regions BGC work (#46972)

Regions work (mostly for BGC) -

+  updated the regions list for newly allocated UOH segs, when we delete segs during sweep/compact UOH
    and deleting segs that were marked eligible for deletion during BGC.
+  updated the region list for SOH segs deleted during BGC.
+  commit mark array for new segs if needed for BGC.
+  need to have BGC's ephemeral sweep look at background_allocated of gen0 regions because we could have
    alloc contexts on some gen0 regions that haven't been fixed up yet so we can't go beyond
    background_allocated. and it needs to set it to 0 when it's done with a region so BGC sweep doesn't
    try to look at it.
+  fixed a bug in GCHeap::IsPromoted where we should return true if it's not in condemned.
+  added the necessarily handle table methods to make STRESS_REGIONS work with embedded GC
+  made some dprintfs that only printed region print heap_segment_mem (region) so it's easier to correlate
+  fixed a bug in process_last_np_surv_region that Peter hit when he wasn't using STRESS_REGIONS where we
    ran out gen0 regions for the new consing_gen alloc context. I'm just getting a new region here and assuming
    we can but we need to make sure we actually can (I've put TODOs for this in the code).

Other work -

+  define VERIFY_HEAP for standalone GC and sample.
+  fixed a bug that also exists for doubly linked FL where we didn't update current_sweep_pos when a GC is
    triggered when we are waiting to acquire the UOH alloc lock which caused us to erroneously set BGC mark
    bit during BGC planning.

=================================================================

I've been running this GCPerfSim cmdline for 15 hours with no problems in the following condition -

gcperfsim.dll -tc 2 -tagb 128 -tlgb 0.05 -lohar 100 -sohsi 10 -lohsi 100 -pohsi 0 -sohpi 0 -lohpi 0 -sohfi 0 -lohfi 0 -pohfi 0 -allocType reference -testKind time -printEveryNthIter 300000

with the following env vars -

complus_GCRegionsRange=20000000
complus_GCName=clrgc.dll
(and env vars for logging)

So standalone GC with WKS GC + BGC + STRESS_REGIONS. I actually did do heap verification but a light weight version.

I also tried with embedded GC but just a little to verify the handle table changes.
src/coreclr/gc/CMakeLists.txt
src/coreclr/gc/gc.cpp
src/coreclr/gc/gcpriv.h
src/coreclr/gc/handletable.cpp
src/coreclr/gc/handletable.h
src/coreclr/gc/handletable.inl
src/coreclr/gc/sample/CMakeLists.txt
src/coreclr/gc/sample/gcenv.ee.cpp