RFR: 8306738: Select num workers for safepoint ParallelCleanupTask
Aleksey Shipilev
shade at openjdk.org
Mon Apr 24 16:21:58 UTC 2023
On Mon, 24 Apr 2023 12:03:23 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
> Select num workers for safepoint ParallelCleanupTask to be at most the number of parallel cleanup tasks `SAFEPOINT_CLEANUP_NUM_TASKS`
>
> Unsure if `WorkerThreads::max_workers()` is more correct than `WorkerThreads::created_workers()` or `WorkerThreads::active_workers()`.
>
> Tested tier1-3 Oracle platforms.
The idea makes sense.
src/hotspot/share/runtime/safepoint.cpp line 607:
> 605: // Parallel cleanup using GC provided thread pool.
> 606: const uint num_workers = MIN2<uint>(SAFEPOINT_CLEANUP_NUM_TASKS, cleanup_workers->max_workers());
> 607: cleanup_workers->run_task(&cleanup, num_workers);
If you go to the definition of `WorkerThreads::run_task(WorkerTask* task)`, then you'll notice it uses `_active_workers`. So we should be doing `MIN2(..., cleanup_workers->active_workers()` here if the current behavior is to be preserved better. I think active workers is correct when GC worker count is dynamic (see `UseDynamicNumberOfGCThreads`).
-------------
PR Review: https://git.openjdk.org/jdk/pull/13616#pullrequestreview-1398388909
PR Review Comment: https://git.openjdk.org/jdk/pull/13616#discussion_r1175518136
More information about the hotspot-runtime-dev
mailing list