RFR: 8322732: ForkJoinPool may underutilize cores in async mode

Doug Lea dl at openjdk.org
Fri May 10 11:37:03 UTC 2024


On Fri, 10 May 2024 07:35:17 GMT, Viktor Klang <vklang 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 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?

The net impact is to place runState field nearer queues ref, which on average reduces cacheline accesses since the are almost always accessed together. (The main focus of this update is to reduce memory contention that would otherwise accompany greater utilization. Most of the adjustments are small, but add up.)

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

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


More information about the core-libs-dev mailing list