RFR: 8297584: G1 parallel phase event for scan heap roots is sent to often

Stefan Johansson sjohanss at openjdk.org
Fri Nov 25 11:30:35 UTC 2022


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.

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

Commit messages:
 - 8297584: G1 parallel phase event for scan heap roots is sent to often

Changes: https://git.openjdk.org/jdk/pull/11362/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11362&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8297584
  Stats: 15 lines in 1 file changed: 6 ins; 8 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/11362.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11362/head:pull/11362

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


More information about the hotspot-gc-dev mailing list