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

Make ReferenceProcessor::_num_queues external immutable

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 19
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Subcomponent:
      gc

      Description

      In `ReferenceProcessor`, the multi-thread degree of ref-processing is subject to multiple constraints:

      1. `mt_processing_degree` passed to the constructor
      2. the global boolean flag `ParallelRefProcEnabled`
      3. #active workers in the worker-pool from each collector

      The effect of 1 & 3 is manifests via `_num_queues` inside the constructor and `set_active_mt_degree` method. Hence the body of the following method:

      ```
      bool ReferenceProcessor::processing_is_mt() const {
        return ParallelRefProcEnabled && _num_queues > 1;
      }
      ```

      Such arrange leads to wasted memory in the situation where `ParallelRefProcEnabled == false` && `ParallelGCThreads > 1` && `ParallelGCThreads > ConcGCThreads` -- unnecessary ref queues are created and those extra queues are never actually used.

      One way to remedy the situation is to include the effect of 2 in `_num_queues` inside the constructor and drop the API mutating `_num_queues` (`set_active_mt_degree`). In other words, the ref-processor would have access to the worker-pool from the collector and take constraint 3 into account in each subphase of ref-processing while adjusting `_num_queues`. Consequently, `_num_queues` will appear as external immutable.

      Additionally, `processing_is_mt()` becomes `(_num_queues > 1)` essentially.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ayang Albert Yang
              Reporter:
              ayang Albert Yang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: