RFR: 8297186: G1 triggers unnecessary full GCs when heap utilization is low [v3]

Kim Barrett kbarrett at openjdk.org
Wed Nov 30 17:38:26 UTC 2022


On Wed, 23 Nov 2022 09:50:32 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Hi all,
>> 
>>   can I have reviews for this change that better enforces that after gc there is at least one eden region to allocate into?
>> 
>> That avoids the problem described in the PR.
>> 
>> Thanks,
>>   Thomas
>
> Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Improve test avoiding heap fragmentation so that it succeeds

Changes requested by kbarrett (Reviewer).

src/hotspot/share/gc/g1/g1Policy.cpp line 316:

> 314:     log_trace(gc, ergo, heap)("Young target length: Desired young length smaller than allocated after GC. Allowing one extra eden region.");
> 315:     desired_young_length = allocated_young_length + 1;
> 316:   }

I don't understand this.  The log message doesn't match the test being performed (log says "smaller" but
the test is for `<=`).  And the action taken seems kind of mysterious.  I think it's to force us into the `else`
clause of the following `if` statement.  It might be more obvious if instead of this the `if` condition was
changed to `(!after_gc && allocated_young_length >= desired_young_length)`, though then there is some
additional stuff to do in the `else` branch too.  A comment instead would help.

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

PR: https://git.openjdk.org/jdk/pull/11209


More information about the hotspot-gc-dev mailing list