RFR: 8322732: ForkJoinPool may underutilize cores in async mode

Doug Lea dl at openjdk.org
Fri May 10 12:12:31 UTC 2024


On Fri, 10 May 2024 08:30:24 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 2167:
> 
>> 2165:             }
>> 2166:         }
>> 2167:         return stat;
> 
> @DougLea Since `stat` is a local, and is only written to once per branch it might make sense to just return from each of the branches?

A similar answer as above: using a single return avoids compiler generating branches to its own synthetic single return. Worthwhile only when whole method is of this form (I did check this one.)

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

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


More information about the core-libs-dev mailing list