At the moment we compact all zones that we collect in a shrinking GC. However this is wasteful, because we may not be able to free much or any memory at all. We should skip compacting zones if we cannot free up a certain proportion of their allocated memory.
Created attachment 8567100 [details] [diff] [review] skip-unnecessary-compaction This patch calculates the number of arenas that we are going to free up for each zone before deciding whether to compact or skip that zone. The decision is based on the GC reason so that OOM or memory pressure GCs will free up all possible memory. Otherwise we only compact if we can free at least 2% of the zone's GC heap memory (I made this number up so tuning may be required).