RFR: 8322732: ForkJoinPool may underutilize cores in async mode

Doug Lea dl at openjdk.org
Sun May 12 13:08:14 UTC 2024


On Sat, 11 May 2024 23:39:04 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 962:
> 
>> 960:      * minimum allowed timeout value.
>> 961:      */
>> 962:     static final long TIMEOUT_SLOP = 20L;
> 
> Might be worth spelling out the temporal unit used here.

done.

> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1833:
> 
>> 1831:                 if (phase != 0) {          // else failed to start
>> 1832:                     replaceable = true;
>> 1833:                     if (w.top - w.base > 0) {
> 
> @DougLea Is this check sufficiently cheaper than trying to poll blind?

Done.

> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1916:
> 
>> 1914:      */
>> 1915:     private long releaseAll() {
>> 1916:         long c = ctl;
> 
> `ctl` is not re-read inside the endless loop, is there any risk for a stale `ctl` to make `releaseAll()` never terminate?

It is implicitly read via the compareAndExchangeCtl

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1597633326
PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1597633209
PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1597633649


More information about the core-libs-dev mailing list