dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.98k stars 4.66k forks source link

Avoid wasted commit in NoGCRegions #90672

Open cshung opened 1 year ago

cshung commented 1 year ago

There was an earlier discussion brought up about this. In the implementation of NoGCRegion for regions, there is a potential of wasted commit if this happens.

StartNoGCRegion -> GarbageCollect -> ... -> should_proceed_for_no_gc -> extend_soh_for_no_gc -> commit some memory.

but then performed a GC, and then

allocate_for_no_gc_after_gc -> extend_soh_for_no_gc -> commit the memory again.

The repeated work is wasteful.

ghost commented 1 year ago

Tagging subscribers to this area: @dotnet/gc See info in area-owners.md if you want to be subscribed.

Issue Details
There was an earlier discussion brought up about this. In the implementation of NoGCRegion for regions, there is a potential of wasted commit if this happens. StartNoGCRegion -> GarbageCollect -> ... -> should_proceed_for_no_gc -> extend_soh_for_no_gc -> commit some memory. but then performed a GC, and then allocate_for_no_gc_after_gc -> extend_soh_for_no_gc -> commit the memory again. The repeated work is wasteful.
Author: cshung
Assignees: -
Labels: `area-GC-coreclr`
Milestone: -