RFR: 8309403: Serial: Remove the useless adaptive size policy in GenCollectedHeap

Guoxiong Li gli at openjdk.org
Wed Jun 7 11:44:05 UTC 2023


On Wed, 7 Jun 2023 11:06:53 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> > why do we set it to false again
> 
> `WB_FullGC` should restore the global env. Otherwise, the following non-whitebox-full-gc cycles can unnecessarily clear soft-refs.
>
> > If we have a reason to set it to false again, why do other GCs not set it
> 
> G1 does that inside `WB_FullGC`. ZGC doesn't rely on `SoftRefPolicy::should_clear_all_soft_refs`. Parallel doesn't clear the flag, which I believe is a bug.
> 
> This inconsistency is probably accidental; keeping the global env intact (essentially what ZGC does) seems the cleanest approach IMO. I wonder if other collectors can also adopt it; in another PR(s) ofc.

Thanks for your answers. I propose the following changes.

In this patch:
- Serial GC should use `SoftRefPolicy` instead of `SoftRefGenPolicy`, which is done in this patch now.
- Serial GC should restore the global env inside `WB_FullGC`, just like the G1. Because both of them don't implement overheap limit check now.
- Don't remove the class `SoftRefGenPolicy` because it will be used by Parallel GC in the future. 

In another patch:
- Rename `SoftRefGenPolicy` in order to avoid misunderstanding, such as `GCOverhearLimitSoftRefPolicy`.
- Use `SoftRefGenPolicy` (may be renamed at the first step) in Parallel GC.

What do you think?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14296#discussion_r1221437135


More information about the hotspot-gc-dev mailing list