On Mon, 19 Oct 2026 20:26:47 GMT, Patrick Fontanilla <[email protected]> wrote:
>> ### Summary >> For Shenandoah and ZGC, safepoint workers were created at startup and only >> used for heap dump and heap inspection. If heap dump or heap inspection >> never runs, these threads consume memory without doing any work. For G1 and >> Parallel, GC pauses and non-GC safepoints share the GC worker pool, so heap >> dump and heap inspection don't need a separate worker pool. The downside is >> that dump and inspection work contributes to GC CPU time, which can affect >> how G1 sizes its heap. >> >> ### Changes >> Safepoint workers are replaced with a diagnostic worker pool used by heap >> dump and heap inspection. The diagnostic worker pool is created on the first >> heap dump or heap inspection that requests more than one thread, if the >> collector supports parallel heap iteration and >> `os::active_processor_count()` > 1. The pool holds at most >> `os::active_processor_count()` workers, and workers stay alive until the VM >> exits. >> >> G1 and Parallel no longer lend their GC worker pool. ZGC's `ZRuntimeWorkers` >> is deleted because it's no longer used. For Shenandoah, diagnostic workers >> have no GCLAB and fall back to shared allocation when they evacuate objects. >> >> ### Testing all passed >> - linux-x86_64-server-fastdebug: `hotspot:tier1_gc`, >> `hotspot:tier1_serviceability`, `gc/shenandoah` >> - GHA >> - Internal CI pipeline >> >> ### Benchmarking >> Running HeapDump.java from >> [JDK-8319650](https://bugs.openjdk.org/browse/JDK-8319650) with 8 GB heap >> and 36 CPUs >> ``` >> ┌───────────┬─────────────────────┬─────────────────────┐ >> │ Collector │ Master │ Branch │ >> ├───────────┼─────────────────────┼─────────────────────┤ >> │ Serial │ 3.200, 3.197, 3.199 │ 3.231, 3.247, 3.221 │ >> ├───────────┼─────────────────────┼─────────────────────┤ >> │ Parallel │ 0.971, 0.953, 0.976 │ 0.957, 0.921, 0.918 │ >> ├───────────┼─────────────────────┼─────────────────────┤ >> │ G1 │ 0.999, 1.009, 0.985 │ 0.936, 0.948, 0.911 │ >> └───────────┴─────────────────────┴─────────────────────┘ >> >> >> >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Patrick Fontanilla has updated the pull request incrementally with one > additional commit since the last revision: > > Feedback Looks good to me. Consider a few nits. src/hotspot/share/services/diagnosticWorkers.hpp line 35: > 33: class WorkerThreads; > 34: > 35: // Worker pool shared by heap dump and heap inspection. The pool is > created lazily "Worker pool used by diagnostic tasks, for example heap dump and heap inspection." src/hotspot/share/services/diagnosticWorkers.hpp line 51: > 49: > 50: // Applies the closure to each diagnostic worker if the worker pool has > been created. > 51: static void diagnostic_threads_do(ThreadClosure* tc); Can be just `threads_do`. ------------- Marked as reviewed by shade (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/33218#pullrequestreview-5581796073 PR Review Comment: https://git.openjdk.org/jdk/pull/33218#discussion_r4322344529 PR Review Comment: https://git.openjdk.org/jdk/pull/33218#discussion_r4322340854
