RFR: 8322732: ForkJoinPool may underutilize cores in async mode

Viktor Klang vklang at openjdk.org
Fri May 10 07:38:03 UTC 2024


On Tue, 7 May 2024 22:50:18 GMT, Doug Lea <dl at openjdk.org> wrote:

> This set of changes address causes of poor utilization with small numbers of cores due to overly aggressive contention avoidance. A number of further adjustments were needed to still avoid most contention effects in deployments with large numbers of cores

src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 978:

> 976:      * of two, at least 2. See above.
> 977:      */
> 978:     static final int INITIAL_QUEUE_CAPACITY = 1 << 7;

@DougLea Interesting change—what impact did you notice when doubling this?

src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 994:

> 992:     static final long SHUTDOWN        = 1L <<  1;   // terminate when quiescent
> 993:     static final long TERMINATED      = 1L <<  2;   // only set if STOP also set
> 994:     static final long RS_LOCK         = 1L <<  3;   // lowest seqlock bit

@DougLea I presume making these longs was to enable the int-field padding?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1596382962
PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1596383529


More information about the core-libs-dev mailing list