-
Enhancement
-
Resolution: Fixed
-
P4
-
14, 17, 20
-
b07
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8308787 | 17.0.8 | Aleksey Shipilev | P4 | Resolved | Fixed | b04 |
The order in which safepoint cleanup subtasks are claimed and executed (by ParallelSPCleanupTask::work()) might not be optimal for minimizing the total time spent in the cleanup task.
Currently it first applies the ParallelSPCleanupThreadClosure to each thread, parallelized among the worker threads. Then each worker thread attempts to claim and execute a set of serial subtasks, in an order that might not have been chosen for optimiality.
Parallel worker threads working on the serial subtasks should attempt to claim them in order of decreasing expected duration. Statically guessing an expected duration order for the serial subtasks might be good enough. Alternatively, estimating their durations dynamically and sorting their claim ordering accordingly might be possible, at least for some.
If the per-thread durations for the thread cleanups are generally smaller than the larger serial subtask durations, and are reasonably balanced, it should be better to do the thread cleanups last. However, a problem that can arise from that is that there might be a thread with a very large stack, and reaching it late in the iteration over the threads may significantly extend the total cleanup task time, with many workers idle at the end. Stack size might be used to order the thread cleanups dynamically, possibly interleaved with the serial subtasks.
Currently it first applies the ParallelSPCleanupThreadClosure to each thread, parallelized among the worker threads. Then each worker thread attempts to claim and execute a set of serial subtasks, in an order that might not have been chosen for optimiality.
Parallel worker threads working on the serial subtasks should attempt to claim them in order of decreasing expected duration. Statically guessing an expected duration order for the serial subtasks might be good enough. Alternatively, estimating their durations dynamically and sorting their claim ordering accordingly might be possible, at least for some.
If the per-thread durations for the thread cleanups are generally smaller than the larger serial subtask durations, and are reasonably balanced, it should be better to do the thread cleanups last. However, a problem that can arise from that is that there might be a thread with a very large stack, and reaching it late in the iteration over the threads may significantly extend the total cleanup task time, with many workers idle at the end. Stack size might be used to order the thread cleanups dynamically, possibly interleaved with the serial subtasks.
- backported by
-
JDK-8308787 Optimize safepoint cleanup subtask order
-
- Resolved
-
- blocks
-
JDK-8306738 Select num workers for safepoint ParallelCleanupTask
-
- Resolved
-
- relates to
-
JDK-8246476 remove AsyncDeflateIdleMonitors option and the safepoint based deflation mechanism
-
- Resolved
-
- links to
-
Commit openjdk/jdk17u-dev/464a32b0
-
Commit openjdk/jdk/96a542fe
-
Review openjdk/jdk17u-dev/1377
-
Review openjdk/jdk/9515
(2 links to)