Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8227060

Optimize safepoint cleanup subtask order

XMLWordPrintable

    • b07

        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.

              coleenp Coleen Phillimore
              kbarrett Kim Barrett
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: