RFR: 8274178: G1: Occupancy value in IHOP logging and JFR event is inaccurate [v4]

Albert Mingkun Yang ayang at openjdk.org
Wed Nov 12 18:53:02 UTC 2025


On Tue, 11 Nov 2025 15:08:23 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Hi all,
>> 
>>   please review this change that modifies heap occupancy reporting for IHOP to use the actual occupancy value the IHOP calculation actually uses.
>> 
>> I.e. previously IHOP logging used to report `G1CollectedHeap::used()` as occupancy (which is correct at a general level), but for IHOP/marking that value is not interesting, but the "occupancy" value used for comparing against the current heap occupancy threshold.
>> 
>> Testing: tier1-3, GHA
>> 
>> Thomas
>
> Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
> 
>   * fix compilation on osx

src/hotspot/share/gc/g1/g1CollectedHeap.hpp line 1035:

> 1033:   inline void old_set_remove(G1HeapRegion* hr);
> 1034: 
> 1035:   size_t non_young_occupancy_after_allocation(size_t allocation_word_size);

I think the original term `capacity` is less misleading -- with `occupancy` one always need to ponder a bit, is it just used-bytes or is it used-bytes aligned-up by region?

src/hotspot/share/gc/g1/g1IHOPControl.cpp line 66:

> 64:                       percent_of(cur_conc_mark_start_threshold, _target_occupancy),
> 65:                       _target_occupancy,
> 66:                       occupancy,

Not sure if I misunderstood this or not -- this two value `_target_occupancy` vs `occupancy` mean sth quite different, one for whole-heap and the other for non-young regions.

Based on their names, I'd expect them to refer to the same set of regions.

src/hotspot/share/gc/g1/g1IHOPControl.cpp line 189:

> 187: }
> 188: 
> 189: void G1AdaptiveIHOPControl::send_jfr_event(G1NewTracer* tracer, size_t occupancy) {

Why `jfr` in the name? There is nothing related to `jfr` in this context.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28175#discussion_r2519422730
PR Review Comment: https://git.openjdk.org/jdk/pull/28175#discussion_r2519411406
PR Review Comment: https://git.openjdk.org/jdk/pull/28175#discussion_r2519413843


More information about the hotspot-gc-dev mailing list