Conversation
|
Tagging subscribers to this area: @dotnet/gc Issue Details
|
src/coreclr/gc/gc.cpp
Outdated
src/coreclr/gc/gc.cpp
Outdated
There was a problem hiding this comment.
Should the dprintf level be REGIONS_LOG here?
There was a problem hiding this comment.
I will change all of the dprintf's in region_allocator to REGIONS_LOG.
src/coreclr/gc/gc.cpp
Outdated
There was a problem hiding this comment.
Use dprintf level REGIONS_LOG here as well?
src/coreclr/gc/gc.cpp
Outdated
There was a problem hiding this comment.
How about the case where init_table_for_region fails because the mark array cannot be committed? It seems that we would return true in this case, but likely still fail when we later try to get the region.
There was a problem hiding this comment.
good catch! I did check for this (I set region to 0 in init_table_for_region when we can't commit) but I made a mistake when I refactored it out to its own method. should have init_table_for_region return false if we can't commit.
src/coreclr/gc/gc.cpp
Outdated
There was a problem hiding this comment.
Would this AV if commit_mark_array_new_seg failed above?
There was a problem hiding this comment.
it wouldn't - right now the GC bookkeeping datastructure is completely committed for the region's range except for the mark array part.
There was a problem hiding this comment.
but above, you set region to 0, so as heap_segment_mem dereferences it, you would AV before you even get to the brick_of part.
There was a problem hiding this comment.
oh I misunderstood your intention for the question...absolutely, I shouldn't call this when the region is already set to 0
src/coreclr/gc/gc.cpp
Outdated
|
I found a problem with aging handles for the special sweep case. will fix it later today. |
src/coreclr/gc/gcpriv.h
Outdated
There was a problem hiding this comment.
It looks like this could be a local variable instead of a field.
There was a problem hiding this comment.
I specifically wanted this to be a global so it introduces some variation instead of always pinning the 1st, 3rd, etc gen0 region. but I changed it to size_t instead of int.
src/coreclr/gc/gc.cpp
Outdated
There was a problem hiding this comment.
It would be helpful to put a comment, e.g. "Pin one object at the beginning".
src/coreclr/gc/gc.cpp
Outdated
There was a problem hiding this comment.
Ditto: "Pin one object near the middle".
src/coreclr/gc/gc.cpp
Outdated
There was a problem hiding this comment.
I don't understand why we need a new free region here - could you explain?
There was a problem hiding this comment.
it's to prepare for possibly needing to get a new region for gen0 in the later phases.
src/coreclr/gc/gc.cpp
Outdated
There was a problem hiding this comment.
In your comments for the PR, you said in this case we will do a special kind of sweep. The dprintf says we do a full compacting GC. Is there a contradiction, or what am I missing?
There was a problem hiding this comment.
it's the "and find out that we do need it," part - we try to get a new region here just to prepare for if we need it, as long as we don't actually need it, we will be doing a full compacting GC. but if we can't get it here and later find that we actually need it that's when we absolute run out of memory and we only do the special sweep then.
src/coreclr/gc/gc.cpp
Outdated
There was a problem hiding this comment.
Could you put a comment why this should be true?
src/coreclr/gc/gc.cpp
Outdated
There was a problem hiding this comment.
I think it would be good to put a comment explaining how the special sweep mode works, i.e. what's special about it.
+ implemented the logic to handle when we are really running out of memory. We need to be resilient to it during a GC. We might need an empty region per heap so we try to get it up front and if we can't get it and find out that we do need it, we resort to a special sweep mode. + also take virtual memory load into consideration + fixed the logic to decide whether we should compact based on space. + fixed various places when we can't get a region, we need to make sure we don't thread 0 into the region list. + made allocated_since_last_gc per more_space_lock otherwise we are not doing the accounting correctly + moved the pinning for STRESS_REGIONS into a blocking GC otherwise we can have AV from BGC trying to mark the pinned object while it's being constructed + got rid of the places that use the hard coded REGION_SIZE + included one perf change in reset_memory
247995b to
f532c41
Compare
We need to be resilient to it during a GC. We might need an empty region
per heap so we try to get it up front and if we can't get it and find out
that we do need it, we resort to a special sweep mode.
don't thread 0 into the region list.
the accounting correctly
AV from BGC trying to mark the pinned object while it's being constructed