RFR: 8297584: G1 parallel phase event for scan heap roots is sent too often
Stefan Johansson
sjohanss at openjdk.org
Mon Nov 28 09:03:09 UTC 2022
On Fri, 25 Nov 2022 12:53:32 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
>> Please review this enhancement to decrease the number of "GC Phase Parallel" events sent by G1.
>>
>> **Summary**
>> The "GC Phase Parallel" event is used by multiple phases in G1 and for the "ScanHR" phase we currently get an excessive amount of events. In a recent recording of mine more then 75% of these events was of the "ScanHR" type. This event is sent from more than one place in the code and one reason for the excessive amount is that we send the event on a per region basis rather than once per worker.
>>
>> The fix is to move where we send the event so instead of sending it inside `scan_heap_roots(HeapRegion* r)` in the closure we send it in the outer `scan_heap_roots(...)`. So instead of sending it once per region we send it once per worker. The way the event is sent is still not optimal because it will include a bit more than what the name suggests (but that was true before as well).
>>
>> I also move the other place where this event was sent to make it more consistent with the "Code Roots" events sent by the same closure.
>>
>> **Testing**
>> * Local JFR testing and verification that we get a lower number of events.
>> * Mach5 testing of JFR.
>
> src/hotspot/share/gc/g1/g1RemSet.cpp line 852:
>
>> 850: // always need to scan them.
>> 851: if (r->has_index_in_opt_cset()) {
>> 852: EventGCPhaseParallel event;
>
> An option to avoid the per-region events (this and code roots) is to make a single event with two values in them. Just a suggestion.
Yes, that or create a phase name that clearly includes both. I'll filed an RFE to look at this: [JDK-8297692](https://bugs.openjdk.org/browse/JDK-8297692)
-------------
PR: https://git.openjdk.org/jdk/pull/11362
More information about the hotspot-gc-dev
mailing list