RFR: 8358529: GenShen: Heuristics do not respond to changes in SoftMaxHeapSize [v2]
William Kemper
wkemper at openjdk.org
Mon Jun 30 19:15:40 UTC 2025
On Wed, 25 Jun 2025 21:14:01 GMT, Rui Li <duke at openjdk.org> wrote:
>> Generational shenandoah currently doesn't pick up the changes of managed flag `SoftMaxHeapSize` when the app is running. This is because the value of `_soft_max_capacity` in `shenandoahGeneration` is never changed.
>>
>> This change delegates the soft max heap size in `shenandoahGeneration` to `ShenandoahGenerationalHeap::heap()->soft_max_capacity()`, which does pick up the flag value changes.
>>
>> Also, found `ShenandoahHeap:: initialize` uses `_num_regions * reg_size_bytes` rather than user input flag value. Updated to using actual flag value.
>
> Rui Li has updated the pull request incrementally with one additional commit since the last revision:
>
> No need atomic load in initialization
Changes requested by wkemper (Reviewer).
src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp line 1017:
> 1015: size_t ShenandoahGeneration::soft_max_capacity() const {
> 1016: size_t capacity = ShenandoahGenerationalHeap::heap()->soft_max_capacity();
> 1017: log_debug(gc)("soft_max_capacity: %zu", capacity); // TestDynamicSoftMaxHeapSize needs the log line to validate
This will be a hot method. It's called by the heuristic frequently to test if it should start a GC. We may also even test this on the allocation path. I'd rather not have a log level check here just for one test case. Can we move this log message to the place where the value is updated? I expect the value to change _much less_ frequently than it is read.
-------------
PR Review: https://git.openjdk.org/jdk/pull/25943#pullrequestreview-2972355280
PR Review Comment: https://git.openjdk.org/jdk/pull/25943#discussion_r2175731624
More information about the hotspot-gc-dev
mailing list