RFR: 8306738: Select num workers for safepoint ParallelCleanupTask [v2]

Aleksey Shipilev shade at openjdk.org
Thu Apr 27 09:35:58 UTC 2023


On Thu, 27 Apr 2023 07:49:28 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

> So we need to investigate the cost of each operation, the possibility (and granularity) of estimating the work for each task and when the cost of spinning up worker threads is amortised by the parallel speedup.

Yes. 

I think the guiding principle here is that thread hand-off (delivering the wake up signal, wake up lag, waiting for worker thread termination) can easily take tens of microseconds. We established that in Parallel Streams work in JDK 8. So for tasks that only notify other, already threaded subsystems, spinning up the thread just to perform the notification of _another_ thread seems wasteful.

I think the only subtasks that do actual work are lazy roots (since they walk the unbounded number of threads) and IC buffer cleanups (when they have work, they can walk lots of IC stubs). The compounding factor is that string/symbol/oopstorage cleanups all take `ServiceLock`, and not only we spin up worker threads unnecessarily to essentially deliver a flag update, we also contend the worker threads over that lock! Oops. I wonder if that's where part of the cleanup time spikes comes from.

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

PR Comment: https://git.openjdk.org/jdk/pull/13616#issuecomment-1525256657


More information about the hotspot-runtime-dev mailing list