RFR: 8270100: Fix some inaccurate GC logging

Volker Simonis simonis at openjdk.java.net
Wed Jul 14 08:22:16 UTC 2021


On Tue, 13 Jul 2021 09:40:07 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> @albertnetymk  your latest proposal is still changing the current semantics. Before, the shrink factor was reset on every invocation of `CardGeneration::compute_new_size()`. With your proposal, it will only be reset if we expand the heap.
>> 
>> My patch is really just a trivial fix of some logging errors. I'm not against changing or improving it, but before I introduce any behavioral changes, I'd like to hear a second opinion.
>
>> Before, the shrink factor was reset on every invocation of CardGeneration::compute_new_size(). With your proposal, it will only be reset if we expand the heap.
> 
> Indeed, my suggestion is flawed.
> 
>> "decaying" the shrink factor on every CardGeneration::compute_new_size() call makes sense.
> 
> Agree.
> 
>> so I would probably just set current_shrink_factor and _shrink_factor to 100 at the top of CardGeneration::compute_new_size if ShrinkHeapInSteps is false
> 
> Sounds good to me.
> 
> Re `NewSizeThreadIncrease`, what's the motivation for having it (used only by Serial) in the first place? Going through the git-log, I can only find the overflow-fix from JDK-8144527.

@albertnetymk, @tschatzl thanks for your feedback. From what I understand we all agree that this change should only fix the reported GC logging issues without changing the semantics or behavior of the underlying GC algorithm. My new version of the fix tries to achieve exactly this based on your recommendations:

- I've introduced a new helper function `calculate_thread_increase_size()` which takes the number of threads as an argument and returns the `thread_increase_size` which is then passed to `calculate_thread_increase_size()`.
- For the shrink factor I now set `_shrink_factor` to 100 right in the constructor if `ShrinkHeapInSteps` is not set and never change it. Notice that  `ShrinkHeapInSteps` is not manageable, so this should be fine. If  `ShrinkHeapInSteps` is true, `_shrink_factor` will be reset to zero at every invocation of `CardGeneration::compute_new_size()` just as before the change.
 
 With these changes the logging issues are fixed without any change in functionality.

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

PR: https://git.openjdk.java.net/jdk/pull/4727


More information about the hotspot-gc-dev mailing list