RFR: 8307348 - Parallelize heap walk for ObjectCount(AfterGC) JFR event collection [v5]

olivergillespie duke at openjdk.org
Fri May 5 11:30:23 UTC 2023


> ObjectCount(AfterGC) event does a full single-threaded heap scan at a safepoint. After https://bugs.openjdk.org/browse/JDK-8215624, it is trivial to use the parallel version of the heap scan, reducing the time spent at the safepoint, and thus reducing the overhead of this event.
> 
> The performance improvement is obvious, but just for confirmation, on my 16-core host, at around 1GB occupancy:
> 
> 
> Before: 770ms ( [3.059s][debug][gc,phases         ] GC(13) Report Object Count 770.317ms )
>  After:  92ms ( [2.335s][debug][gc,phases         ] GC(13) Report Object Count  91.742ms )
> 
> 
> Question 1: Should this be the default behaviour for populate_table (use the number active workers as the parallelism, if nothing else specified)?
> 
> Question 2: Is active_workers the correct value to use here? Or is max_workers more appropriate?

olivergillespie has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:

 - Rework
   
   Pass workers through from caller. Move some of the specific handling
   to the VM Op for heap inspection.
 - Merge remote-tracking branch 'origin/master' into 8307348
 - Use ParallelGCThreads instead of active_workers
 - Fix compile error
   
   ```
    === Output from failing command(s) repeated here ===
   * For target hotspot_variant-server_libjvm_objs_gcTrace.o:
   /home/runner/work/jdk/jdk/src/hotspot/share/gc/shared/gcTrace.cpp: In member function 'void GCTracer::report_object_count_after_gc(BoolObjectClosure*)':
   /home/runner/work/jdk/jdk/src/hotspot/share/gc/shared/gcTrace.cpp:114:48: error: invalid use of incomplete type 'class CollectedHeap'
     114 |       WorkerThreads* workers = Universe::heap()->safepoint_workers();
         |                                                ^~
   In file included from /home/runner/work/jdk/jdk/src/hotspot/share/gc/shared/gcTrace.cpp:35:
   /home/runner/work/jdk/jdk/src/hotspot/share/memory/universe.hpp:42:7: note: forward declaration of 'class CollectedHeap'
      42 | class CollectedHeap;
         |       ^~~~~~~~~~~~~
   
   * All command lines available in /home/runner/work/jdk/jdk/build/linux-x64/make-support/failure-logs.
   === End of repeated output ===
   ```
 - Fix compile error
 - 8307348 - Parallelize heap walk for ObjectCount(AfterGC) JFR event collection

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/13774/files
  - new: https://git.openjdk.org/jdk/pull/13774/files/711cb643..3d00b05f

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13774&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13774&range=03-04

  Stats: 8729 lines in 231 files changed: 6893 ins; 964 del; 872 mod
  Patch: https://git.openjdk.org/jdk/pull/13774.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13774/head:pull/13774

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


More information about the hotspot-gc-dev mailing list