RFR: 8308009: Generational ZGC: OOM before clearing all SoftReferences

Axel Boldt-Christmas aboldtch at openjdk.org
Wed May 24 12:50:58 UTC 2023


On Wed, 24 May 2023 12:18:19 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

> When a major GC in generational ZGC with a different cause that doesn’t pre-clean and doesn’t clear soft references, we ask if there are allocations stalled on old. And part of that condition is to check if we are not stalled on young. So if an allocation request comes in just before such a “weak” major GC, we will say we won’t clear soft references. But after that major collection we will satisfy all the constraints to throw OOM as both an YC and OC has passed since the allocation request was installed.
> The solution is to let the driver remember if it cleared soft references or not, and only throw OOM if it cleared soft references.

I think it looks good.

Only one thing I can think of. There is an implicit assumption here that should_clear_soft_references implies should_preclean_young which is required to be spec compliant. Maybe `should_preclean_young` should start with 
```c++
if (should_clear_soft_references(cause)) {
  return true;
}

to make this clearer. Or even short circuit the `if (should_preclean_young(...))` directly in `ZDriverMajor::collect_young`

-------------

Marked as reviewed by aboldtch (Committer).

PR Review: https://git.openjdk.org/jdk/pull/14122#pullrequestreview-1441762825


More information about the hotspot-gc-dev mailing list